#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する
class Solve {
public:
    int N;
    vector<ll> A;

    vector<vector<ll>> dp;
    vector<vector<ll>> rdp;

    void input() {
        cin >> N;
        A.resize(N);
        rep(i, 0, N) cin >> A[i];
        dp.resize(N, vector<ll>(40, INFl));
        rdp.resize(N, vector<ll>(40, INFl));

    }

    //X * 2 ^ x <= Y * 2 ^ yとなる最小のyを見つける
    ll compute(ll X, int x, ll Y) {
        ll left = X;
        for (int i = 0; i < x; ++i) {
            left <<= 1;
        }

        ll ret = 0ll;
        ll right = Y;
        while (left > right) {
            right <<= 1;
//            left >>= 1;
            ret++;
        }
        return ret;
    }

    //A[l]に-2を掛ける動作をx回おこなうとA[l]以降で単調増加になるには合計何回?
    // xは偶数
    ll rec(int l, int x) {
        if (x % 2 == 1)
            exit(-1);

        if (x > 30) {
            ll ret = rec(l, 30);
            ret += 1ll * (N - l) * (x - 30);
            return ret;
        }
        if (dp[l][x] != INFl) return dp[l][x];

        if (l == N - 1) {
            return dp[l][x] = x;
        }

        ll y = compute(A[l], x, A[l + 1]);
        if (y % 2)y++;
        ll ret = rec(l + 1, (int) y);
        ret += x;

        return dp[l][x] = ret;
    }

    // xは奇数
    ll rrec(int r, int x) {
        if (x % 2 == 0)
            exit(-1);

        if (x > 29) {
            ll ret = rrec(r, 29);
            ret += 1ll * (r + 1) * (x - 29);
            return ret;
        }

        if (rdp[r][x] != INFl) return rdp[r][x];

        if (r == 0) {
            return rdp[r][x] = x;
        }

//        ll y = compute(A[r] * 2, x, A[r - 1]);
        ll y = compute(A[r], x, A[r - 1]);
        if (y % 2 == 0) y++;
        ll ret = rrec(r - 1, (int) y);
        ret += x;

        return rdp[r][x] = ret;
    }

    void solve() {
        input();

        ll ans = rec(0, 0);
        chmin(ans, rrec(N - 1, 1));
        for (int i = 1; i < N; ++i) {
            ll tmp1 = INFl;
            ll tmp2 = INFl;
            for (int j = 1; j < 2; j += 2) {
                ll tmp = rrec(i - 1, j);
                chmin(tmp1, tmp);
            }

            for (int j = 0; j <= 0; j += 2) {
                ll tmp = rec(i, j);
                chmin(tmp2, tmp);
            }

            ll kouho = tmp1 + tmp2;
            chmin(ans, kouho);
        }

        cout << ans << endl;
    }
};


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    Solve().solve();


    return 0;
}


Measured memory_bytes: 161152