#include <bits/stdc++.h>
using namespace std;

typedef long long llt;

const int MaxN = 200000 + 5, MaxV = 1000000 + 5;
const llt INF = 0x7F7F7F7F7F7F7F7F;

int N;
llt A[2][MaxN];
llt dp[2][MaxN];
int par[MaxN];

struct SegmentTree {
    int L[MaxV], R[MaxV];
    llt Sum[MaxV], tag[MaxV];

    inline void Push_up(int i) {
        Sum[i] = Sum[i << 1] + Sum[i << 1 | 1];
    }

    inline void Push_down(int i) {
        if (tag[i] != 0) {
            int lson = i << 1, rson = i << 1 | 1;
            tag[lson] += tag[i]; tag[rson] += tag[i];
            Sum[lson] += (R[lson] - L[lson] + 1) * tag[i];
            Sum[rson] += (R[rson] - L[rson] + 1) * tag[i];
            tag[i] = 0;
        }
    }

    void Build_Tree(int left, int right, int i) {
        L[i] = left, R[i] = right;
        if (left == right) return;
        int mid = (L[i] + R[i]) >> 1;
        Build_Tree(left, mid, i << 1);
        Build_Tree(mid + 1, right, i << 1 | 1);
    }

    void Update_Tree(int left, int right, int val, int i) {
        if (left == L[i] && right == R[i]) {
            Sum[i] += (right - left + 1) * val;
            tag[i] += val;
            return;
        }
        Push_down(i);
        int mid = (L[i] + R[i]) >> 1;
        if (right <= mid) Update_Tree(left, right, val, i << 1);
        else if (left > mid) Update_Tree(left, right, val, i << 1 | 1);
        else {
            Update_Tree(left, mid, val, i << 1);
            Update_Tree(mid + 1, right, val, i << 1 | 1);
        }
        Push_up(i);
    }

    llt Query_Tree(int left, int right, int i) {
        if (left == L[i] && right == R[i]) return Sum[i];
        Push_down(i);
        int mid = (L[i] + R[i]) >> 1;
        if (right <= mid)
            return Query_Tree(left, right, i << 1);
        else if (left > mid)
            return Query_Tree(left, right, i << 1 | 1);
        else {
            llt lc = Query_Tree(left, mid, i << 1),
                rc = Query_Tree(mid + 1, right, i << 1 | 1);
            return lc + rc;
        }
    }
} T, S;

void init() {
    scanf("%d", &N);
    for (int i = 1; i <= N; ++i) {
        scanf("%lld", &A[1][i]);
        A[0][i] = A[1][i] * 2;
    }
}

int Find(int x) {
    return x == par[x] ? x : par[x] = Find(par[x]);
}

// x <= y -> true  x > y -> false;
inline bool cmp(llt x, llt tx, llt y, llt ty) {
    // printf("cmp(%lld, %lld, %lld, %lld)\n", x, tx, y, ty);
    if (tx == ty) return x <= y;
    else if (tx <= ty) {
        for (llt i = ty; i > tx; --i) {
            y *= 4;
            if (y >= x) return true;
        }
        return x <= y;
    } else {
        for (llt i = tx; i > ty; --i) {
            x *= 4;
            if (x > y) return false;
        }
        return x <= y;
    }
}

void solve() {
    for (int i = 1; i <= N; ++i) par[i] = i;
    dp[0][1] = 0; T.Build_Tree(1, N, 1);
    for (int i = 2; i <= N; ++i) {
        dp[0][i] = dp[0][i - 1];
        if (cmp(A[0][i], 0, A[0][i - 1], T.Query_Tree(i - 1, i - 1, 1)) == true) continue;
        while (cmp(A[0][i], 0, A[0][i - 1], T.Query_Tree(i - 1, i - 1, 1)) == false) {
            int p = Find(i - 1);
            T.Update_Tree(p, i - 1, 1, 1);
            while (p != 1 && cmp(A[0][p], T.Query_Tree(p, p, 1), A[0][p - 1], T.Query_Tree(p - 1, p - 1, 1)) == false) {
                int g = Find(p - 1);
                par[p] = g;
                T.Update_Tree(g, p - 1, 1, 1);
                p = g;
            }
            dp[0][i] += (i - p) * 2;
        }
        par[i] = Find(i - 1);
    }

    for (int i = 1; i <= N; ++i) par[i] = i;
    dp[1][N] = 0; S.Build_Tree(1, N, 1);
    for (int i = N - 1; i >= 1; --i) {
        dp[1][i] = dp[1][i + 1];
        // puts("Q1:");
        if (cmp(A[1][i], 0, A[1][i + 1], S.Query_Tree(i + 1, i + 1, 1)) == true) continue;
        // puts("Q2:");
        while (cmp(A[1][i], 0, A[1][i + 1], S.Query_Tree(i + 1, i + 1, 1)) == false) {
            int p = Find(i + 1);
            S.Update_Tree(i + 1, p, 1, 1); // printf("Update(%d, %d, 1)\n", i + 1, p);
            // puts("Q3:");
            while (p != N && cmp(A[1][p], S.Query_Tree(p, p, 1), A[1][p + 1], S.Query_Tree(p + 1, p + 1, 1)) == false) {
                int g = Find(p + 1);
                par[p] = g;
                S.Update_Tree(p + 1, g, 1, 1); // printf(" Update(%d, %d, 1)\n", p + 1, g);
                p = g;
            }
            dp[1][i] += (p - i) * 2;
        }
        par[i] = Find(i + 1);
    }

    llt ans = INF;
    for (int i = 0; i <= N; ++i) ans = min(ans, dp[0][i] + i + dp[1][i + 1]);
    cout << ans << endl;
}

int main() {
    init();
    solve();
    return 0;
}

Measured memory_bytes: 48128