#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define db double
#define pii pair<int,int>
#define pli pair<ll,int>
#define pil pair<int,ll>
#define pll pair<ll,ll>
#define mat vector<vector<int>>
const int inf = 1 << 30;
const ll linf = 1LL << 60;
const db EPS = 1e-7;
template<class T> void chmin(T& x, T y){if(x > y) x = y;}
template<class T> void chmax(T& x, T y){if(x < y) x = y;}

int N;
ll A[200010];
ll cnt1[200010];
ll cnt2[200010];
ll d[50];


int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> N;
    cnt1[1] = 1;
    for(int i = 1; i <= N; ++i){
        cin >> A[i];
    }

    d[0] = 1;
    for(int i = 1; i <= 40; ++i){
        d[i] = d[i - 1] * 4;
    }

    stack<pll> st;
    st.push({linf, 1});

    for(int i = 2; i <= N; ++i){
        cnt1[i] = cnt1[i - 1] + 1;
        ll cp = A[i - 1];
        ll cnt = 0;
        
        if(cp < A[i]){
            int lb = 0, ub = 15;
            while(ub - lb > 1){
                int mid = (ub + lb) / 2;
                if(d[mid] * cp >= A[i]) ub = mid;
                else lb = mid;
            }
            cnt = ub * 2;
           
            ll pre = i;
            while(cnt != 0){
                pll p = st.top();
                st.pop();

                if(cnt <= p.first){
                    p.first -= cnt;
                    cnt1[i] += cnt * (pre - p.second);
                    cnt = 0;
                    if(p.second == 1) st.push({linf, 1});
                    else if(p.first != 0) st.push(p);
                }else{
                    cnt1[i] += cnt * (pre - p.second);
                    cnt -= p.first;
                    pre = p.second;
                }
            }
        }else{
            cp = A[i];
            int lb = 0, ub = 15;
            while(ub - lb > 1){
                int mid = (ub + lb) / 2;
                if(d[mid] * cp > A[i - 1]) ub = mid;
                else lb = mid;
            }
            cnt += lb * 2;
            if(cnt != 0) st.push({cnt, i});
        }
    }

    while(!st.empty()) st.pop();
    st.push({linf, N});
    for(int i = N - 1; i >= 1; --i){
        cnt2[i] = cnt2[i + 1];
        ll cp = A[i + 1];
        ll cnt = 0;
        
        if(cp < A[i]){
            int lb = 0, ub = 15;
            while(ub - lb > 1){
                int mid = (ub + lb) / 2;
                if(d[mid] * cp >= A[i]) ub = mid;
                else lb = mid;
            }
            cnt = ub * 2;
            
            ll pre = i;
            while(cnt != 0){
                pll p = st.top();
                st.pop();

                if(cnt <= p.first){
                    p.first -= cnt;
                    cnt2[i] += cnt * (p.second - pre);
                    cnt = 0;
                    if(p.second == 1) st.push({linf, N});
                    else if(p.first != 0) st.push(p);
                }else{
                    cnt2[i] += cnt * (p.second - pre);
                    cnt -= p.first;
                    pre = p.second;
                }
            }
        }else{
            cp = A[i];
            int lb = 0, ub = 15;
            while(ub - lb > 1){
                int mid = (ub + lb) / 2;
                if(d[mid] * cp > A[i + 1]) ub = mid;
                else lb = mid;
            }
            cnt += lb * 2;
            if(cnt != 0) st.push({cnt, i});
        }
    }
    ll ans = linf;
    for(int i = 0; i <= N; ++i){
        chmin(ans, cnt1[i] + cnt2[i + 1]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4992