#include<cstdio>
#include<stack>
#include<vector>

using namespace std;

typedef pair<int, int> P;

int A[200200];
int N;

void input(){
	scanf("%d", &N);
	for(int i = 0; i < N; ++i) scanf("%d", A + i);
}

stack<P> st;

int c[200200];

vector<long long> calcDP(vector<int> vec){
	vector<long long> dp(vec.size());
	for(int i = vec.size() - 1; i >= 1; --i){
		long long prv = vec[i - 1];
		long long cur = vec[i];
		c[i] = 0;
		if(prv > cur){
			while(prv > cur){
				c[i] += 2;
				cur *= 4;
			}
		}else{
			prv *= 4;
			while(prv <= cur){
				prv *= 4;
				c[i] -= 2;
			}
		}
	}
	int N = vec.size();
	dp[N - 1] = 0;
	while(st.size() > 0) st.pop();
	for(int i = N - 2; i >= 0; --i){
		if(c[i + 1] < 0){
			dp[i] = dp[i + 1];
			st.push(P(i + 1, -c[i + 1]));
		}else{
			dp[i] = dp[i + 1];
			int rem = c[i + 1];
			while(rem > 0){
				if(st.empty()) break;
				P p = st.top();
				st.pop();
				if(p.second <= rem){
					long long coe1 = p.first - i - 1;
					long long coe2 = p.second;
					dp[i] += coe1 * coe2;
					rem -= p.second;
				}else{
					long long coe1 = p.first - i - 1;
					long long coe2 = rem;
					dp[i] += coe1 * coe2;
					p.second -= rem;
					st.push(p);
					rem = 0;
				}
			}
			if(rem > 0){
				dp[i] += ((long long)(N - i - 1) * rem);
			}
		}
	}/*
	for(int i = 0; i < N; ++i){
		printf("%d ", vec[i]);
	}
	printf("\n");
	for(int i = 0; i < N; ++i){
		printf("%d ", c[i]);
	}
	printf("\n");
	for(int i = 0; i < N; ++i){
		printf("%lld ", dp[i]);
	}
	printf("\n");*/
	return dp;
}

vector<long long> dp1, dp2;
vector<int> a1, a2;

long long solve(){
	for(int i = 0; i < N; ++i) a1.push_back(A[i]);
	for(int i = N - 1; i >= 0; --i) a2.push_back(A[i]);
	dp1 = calcDP(a1);
	dp2 = calcDP(a2);
	long long ans = 1e12;
	for(int n = 1; n < N; ++n){
		long long cur = n;
		cur += dp1[n];
		cur += dp2[N - n];
		ans = min(ans, cur);
	}
	ans = min(ans, dp1[0]);
	ans = min(ans, N + dp2[0]);
	return ans;
}

int main(){
	input();
	long long ans = solve();
	printf("%lld\n", ans);
	return 0;
}
