#include <bits/stdc++.h>
#define mp make_pair
#define all(vec) vec.begin(), vec.end()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll INF = (1LL << 30) - 1;
const ll LINF = (1LL << 60) - 1;
const double eps = 1e-9;
const ll MOD = 998244353LL;
template <typename T>
void chmin(T& a, T b) {
    a = min(a, b);
};
template <typename T>
void chmax(T& a, T b) {
    a = max(a, b);
};
template <typename T>
vector<T> make_v(size_t a) {
    return vector<T>(a);
}
template <typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type fill_v(T& t, const V& v) {
    t = v;
}
template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type fill_v(T& t, const V& v) {
    for(auto& e : t) {
        fill_v(e, v);
    }
};
int main() {
    ll n;
    cin >> n;
    vector<ll> a(n + 10);
    for(int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    auto dp1 = make_v<ll>(n + 10, 16);
    auto dp2 = make_v<ll>(n + 10, 16);
    fill_v(dp1, LINF);
    fill_v(dp2, LINF);
    dp1[0][0] = 0;
    dp2[n + 1][0] = 0;
    for(ll i = 0; i <= 15; i++) {
        dp1[1][i] = i * 2LL;
        dp2[n][i] = i * 2LL;
        if(a[1] > 0) {
            dp1[1][i]++;
        }
        if(a[n] < 0) {
            dp2[n][i]++;
        }
    }
    for(ll i = 2; i <= n; i++) {
        ll c = 0;
        ll s = a[i - 1], t = a[i];
        if(t > 0) {
            c++;
            t *= -2LL;
        }
        if(s > 0) {
            s *= -2LL;
        }
        for(ll j = 0; j <= 15; j++) {
            ll tt = t;
            ll l = 0, co = 0;
            if(s > tt) {
                ll ss = s;
                while(ss > tt) {
                    ss *= 4LL;
                    co++;
                }
            }
            for(int k = 0; k <= 15; k++) {
                if(s <= tt) {
                    chmin(dp1[i][k], dp1[i - 1][j] + k * 2LL + c);
                    l = k;
                } else {
                    chmin(dp1[i][k], dp1[i - 1][j] + k * 2LL + c +
                                         (i - 1LL) * (k + co - l) * 2LL);
                }
                tt *= 4LL;
            }
            s *= 4LL;
        }
    }
    for(ll i = n - 1; i >= 1; i--) {
        ll s = a[i + 1], t = a[i];
        for(ll j = 0; j <= 15; j++) {
            ll tt = t;
            ll l = 0, co = 0;
            if(tt > s) {
                ll ss = s;
                while(ss < tt) {
                    ss *= 4LL;
                    co++;
                }
            }
            for(ll k = 0; k <= 15; k++) {
                if(tt <= s) {
                    chmin(dp2[i][k], dp2[i + 1][j] + k * 2LL);
                    l = k;
                } else {
                    chmin(dp2[i][k], dp2[i + 1][j] + k * 2LL +
                                         (n - i) * (co + k - l) * 2LL);
                }
                tt *= 4LL;
            }
            s *= 4LL;
        }
    }
    ll ans = LINF;
    for(int i = 0; i <= n; i++) {
        ll l = LINF, r = LINF;
        for(int j = 0; j <= 15; j++) {
            chmin(l, dp1[i][j]);
            chmin(r, dp2[i + 1][j]);
        }
        chmin(ans, l + r);
    }
    cout << (ans == LINF ? -1LL : ans) << endl;
}


Measured memory_bytes: 67456