#include <bits/stdc++.h>

#define mod 1000000007
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define nyan "(=^･ω･^=)"
#define mkp make_pair
#define lP pair<ll, ll>
#define iP pair<int,int>
typedef long long ll;
using namespace std;

ll N, A[200000], LD[200000], RD[200000], L[200001], R[200001], res;
stack<lP>s, t;

ll f(ll x, ll y) {
	int cnt = 0;
	while (x < y) {
		x *= 4;
		cnt += 2;
	}
	return cnt;
}
ll ff(ll x, ll y) {
	int cnt = 0;
	while (x <= y) {
		x *= 4;
		cnt += 2;
	}
	return cnt;
}

int main() {
	cin >> N;
	for (int i = 0; i != N; ++i)
		cin >> A[i];
	for (int i = 0; i != N - 1; ++i) {
		if (A[i] < A[i + 1])
			LD[i] = ff(A[i], A[i + 1]) - 2;
		else
			LD[i] = -f(A[i + 1], A[i]);
	}
	for (int i = 0; i != N - 1; ++i) {
		if (A[i] > A[i + 1])
			RD[i] = ff(A[i + 1], A[i]) - 2;
		else
			RD[i] = -f(A[i], A[i + 1]);
	}
	s.push(mkp(llmax, N - 1));
	for (int i = N - 2; i >= 0; --i) {
		L[i] = L[i + 1];
		if (LD[i] >= 0)
			s.push(mkp(LD[i], i));
		else {
			ll d = -LD[i], p = i;
			ll c = 0;
			while (d) {
				if (s.top().first >= d) {
					s.top().first -= d;
					c += (s.top().second - p)*d;
					d = 0;
				}
				else {
					c += (s.top().second - p)*d;
					d -= s.top().first;
					p = s.top().second;
					s.pop();
				}
			}
			L[i] += c;
		}
	}
	t.push(mkp(llmax, 1));
	for (int i = 2; i != N + 1; ++i) {
		R[i] = R[i - 1];
		if (RD[i-2] >= 0)
			t.push(mkp(RD[i-2], i));
		else {
			ll d = -RD[i-2], p = i;
			ll c = 0;
			while (d) {
				if (t.top().first >= d) {
					t.top().first -= d;
					c += (p - t.top().second)*d;
					d = 0;
				}
				else {
					c += (p - t.top().second)*d;
					d -= t.top().first;
					p = t.top().second;
					t.pop();
				}
			}
			R[i] += c;
		}
	}
	res = llmax;
	for (int i = 0; i != N + 1; ++i) {
		res = min(res, L[i] + R[i] + i);
//		cout << L[i] << sp << R[i] << endl;
	}
	cout << res << endl;
}
