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

typedef long long ll;
typedef pair <int, int> ii;

const int Maxn = 200005;
const ll Inf = 9000000000000000000ll;

int n;
int a[Maxn];
ii p[Maxn];
ll L[Maxn], R[Maxn];
ll res = Inf;

int Add(const ii &a, const ii &b)
{
    if (a.second < b.second) return 0;
    int res = a.second - b.second;
    if (a.first > b.first) res++;
    return res;
}

void Solve(ll R[])
{
    vector <ii> seq;
    for (int i = n - 1; i >= 0; i--) {
        int num = a[i];
        int digs = 0;
        while (num) {
            digs++;
            num /= 4;
        }
        num = a[i];
        while (4ll * ll(num) < 1ll << 30ll)
            num *= 4ll;
        p[i] = ii(num, digs);
        seq.push_back(ii(i, 0));
        while (seq.size() >= 2) {
            int ind = seq.back().first;
            int delt = seq.back().second;
            int ind2 = ind + 1;
            int delt2 = seq[int(seq.size()) - 2].second;
            int got = Add(ii(p[ind].first, p[ind].second + delt), ii(p[ind2].first, p[ind2].second + delt2));
            if (got > 0) {
                seq.pop_back();
                R[i] += 2ll * ll(got) * (seq.back().first - ind);
                seq.back().second += got;
            } else break;
        }
        p[i].second -= seq.back().second;
        R[i] += R[i + 1];
    }
}

int main()
{
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
        scanf("%d", &a[i]);
    Solve(R);
    reverse(a, a + n);
    Solve(L);
    res = min(R[0], L[0] + ll(n));
    for (int i = 0; i + 1 < n; i++)
        res = min(res, R[i + 1] + L[n - 1 - i] + ll(i + 1));
    cout << res << endl;
    return 0;
}
