#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define enter putchar('\n')
#define space putchar(' ')
#define eps 1e-8
#define mo 974711
#define MAXN 200005
//#define ivorysi
using namespace std;
typedef long long int64;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;char c = getchar();T f = 1;
    while(c < '0' || c > '9') {
    if(c == '-') f = -1;
    c = getchar();
    }
    while(c >= '0' && c <= '9') {
    res = res * 10 + c - '0';
    c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
    out(x / 10);
    }
    putchar('0' + x % 10);
}
int N,val[MAXN],pre[MAXN],suf[MAXN];
int64 a[MAXN],dp[2][MAXN],ans;
void Init() {
    read(N);
    for(int i = 1 ; i <= N ; ++i) read(a[i]);
}
void Solve() {
    suf[0] = 1;
    for(int i = 1 ; i <= N ; ++i) suf[i] = i + 1,pre[i] = i - 1;
    pre[N + 1] = N;
    for(int i = N ; i > 1 ; --i) {
        if(a[i] >= a[i - 1]) {
            int64 t = a[i];
            while(t / 4 >= a[i - 1]) {val[i] -= 2; t /= 4;}
        }
        else {
            int64 t = a[i];
            while(t < a[i - 1]) {val[i] += 2; t *= 4;}
        }
    }
    for(int i = N - 1 ; i >= 1 ; --i) {
        dp[0][i] = dp[0][i + 1];
        if(a[i] > a[i + 1]) {
            int t = val[i + 1],p = i + 1;
            while(1) {
                dp[0][i] += 1LL * t * (suf[p] - p);
                if(suf[p] - 1 != p) val[suf[p] - 1] += t;
                if(val[suf[p] - 1] + val[suf[p]] <= 0) break;
                if(suf[p] == N + 1) break;
                t = val[suf[p] - 1] + val[suf[p]];
                p = suf[p];val[p] = t;
                pre[suf[p]] = pre[p];suf[pre[p]] = suf[p];
            }
            pre[suf[i + 1]] = pre[i + 1];
            suf[pre[i + 1]] = suf[i + 1];
        }
    }
    suf[0] = 1;
    for(int i = 1 ; i <= N ; ++i) pre[i] = i - 1,suf[i] = i + 1;
    pre[N + 1] = N;
    memset(val,0,sizeof(val));
    for(int i = 1 ; i < N ; ++i) {
        if(a[i] < a[i + 1]) {
            int64 t = a[i];
            while(t < a[i + 1]) {t *= 4;val[i] += 2;}
        }
        else {
            int64 t = a[i];
            while(t / 4 >= a[i + 1]) {t /= 4;val[i] -= 2;}
        }
    }
    for(int i = 2 ; i <= N ; ++i) {
        dp[1][i] = dp[1][i - 1];
        if(a[i] > a[i - 1]) {
            int t = val[i - 1],p = i - 1;
            while(1) {
                dp[1][i] += 1LL * t * (p - pre[p]);
                if(pre[p] + 1 != p) val[pre[p] + 1] += t;
                if(val[pre[p] + 1] + val[pre[p]] <= 0) break;
                if(pre[p] == 0) break;
                t = val[pre[p] + 1] + val[pre[p]];
                p = pre[p];val[p] = t;
                pre[suf[p]] = pre[p];suf[pre[p]] = suf[p];
            }
            pre[suf[i - 1]] = pre[i - 1];
            suf[pre[i - 1]] = suf[i - 1];
        }
    }
    int64 ans = dp[0][1];
    for(int i = 1 ; i <= N ; ++i) {
        ans = min(dp[1][i] + i + dp[0][i + 1],ans);
    }
    out(ans);enter;
}
int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Init();
    Solve();
    return 0;
}


Measured memory_bytes: 7296