#include <bits/stdc++.h>
#define ll long long
#define INF (1LL << 60)
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto& (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define sar(a,n) cout<<#a<<":";rep(pachico,n)cout<<" "<<a[pachico];cout<<endl

using namespace std;

template<typename S,typename T>auto&operator<<(ostream&o,pair<S,T>p){return o<<"{"<<p.fi<<","<<p.se<<"}";}
template<typename T>auto&operator<<(ostream&o,set<T>s){for(auto&e:s)o<<e<<" ";return o;}
template<typename S,typename T,typename U>
auto&operator<<(ostream&o,priority_queue<S,T,U>q){while(!q.empty())o<<q.top()<<" ",q.pop();return o;}
template<typename K,typename T>auto&operator<<(ostream&o,map<K,T>m){for(auto&e:m)o<<e<<" ";return o;}
template<typename T>auto&operator<<(ostream&o,vector<T>v){for(auto&e:v)o<<e<<" ";return o;}
void ashow(){cout<<endl;}template<typename T,typename...A>void ashow(T t,A...a){cout<<t<<" ";ashow(a...);}

typedef pair<ll, ll> P;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<P> vp;
typedef vector<double> vd;
typedef vector<string> vs;

const int MAX_N = 200005;

ll a[MAX_N], l[MAX_N], r[MAX_N];

ll log4(ll val)
{
    int res = 0;
    while(val){
        val /= 4, res++;
    }
    return res;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    rep(i,n){
        cin >> a[i];
    }
    l[0] = 0, l[1] = 1;
    stack<P> prv;
    rep(i,n-1){
        if(a[i] >= a[i+1]){
            l[i+2] = l[i+1]+1;
            ll res = log4(a[i]/a[i+1]) - 1;
            if(res) prv.push(P(i, res));
        }else{
            ll res = log4((a[i+1]-1)/a[i]);
            ll ad = 1;
            while(!prv.empty()){
                P p = prv.top();
                prv.pop();
                if(p.se > res){
                    prv.push(P(p.fi, p.se-res));
                    ad += 2*res*(i-p.fi);
                    res = 0;
                    break;
                }else if(p.se < res){
                    res -= p.se;
                    ad += 2*p.se*(i-p.fi);
                }else{
                    ad += 2*res*(i-p.fi);
                    res = 0;
                    break;
                }
            }
            if(res) ad += 2*res*(i+1);
            l[i+2] = l[i+1] + ad;
        }
    }
    r[n] = r[n-1] = 0;
    stack<P> prv2;
    for(int i = n-2; i >= 0; i--){
        if(a[i] <= a[i+1]){
            r[i] = r[i+1];
            ll res = log4(a[i+1]/a[i]) - 1;
            if(res) prv2.push(P(i, res));
        }else{
            ll res = log4((a[i]-1)/a[i+1]);
            ll ad = 0;
            while(!prv2.empty()){
                P p = prv2.top();
                prv2.pop();
                if(p.se > res){
                    prv2.push(P(p.fi, p.se-res));
                    ad += 2*res*(p.fi-i);
                    res = 0;
                    break;
                }else if(p.se < res){
                    res -= p.se;
                    ad += 2*p.se*(p.fi-i);
                }else{
                    ad += 2*res*(p.fi-i);
                    res = 0;
                    break;
                }
            }
            if(res) ad += 2*res*(n-1-i);
            r[i] = r[i+1] + ad;
        }
    }
    ll ans = INF;
    rep(i,n+1){
        cmn(ans, l[i]+r[i]);
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 4992