#include <iostream>
#include <cassert>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P;

long long int INF = 1e18;
long long int mod = 1000000007;
double Pi = 3.1415926535897932384626;

vector<ll> G[500005];
vector<P> tree[500010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop

int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "RULD";
//↓,→,↑,←

#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<x;
#define re(i,n) for(i=0;i<n;i++);
#define pub push_back
#define pob push_back
#define lb lower_bound
#define ub upper_bound
#define deba(x) cout<< #x << " = " << x <<endl

ll rui(ll number1,ll number2){
    if(number2 == 0){
        return 1;
    }else{
        ll number3 = rui(number1,number2 / 2);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
ll gcd(ll number1,ll number2){
    if(number1 > number2){
        swap(number1 , number2);
    }
    if(number1 == 0 || number1 == number2){
        return number2;
    }else{
        return gcd(number2 % number1 , number1);
    }
}


ll i,j,k,ii,jj;
ll n,m;
ll a,b,c,d,e,g,h,r;
ll l,ans,num;
ll x[1000005],y[500005],z[500005];
ll nega[500005],posi[500005];
ll len[500005],dep[500005];
bool dame,flag;
//char s[500005],t[500005];
//bool used[500005];
ll snum;




int main(){
    cin >> n;
	for(i=0;i<n;i++){
		cin >> x[i];
	}
	posi[n-1] = 0;
	snum = 0;
	len[snum] = 1;
	dep[snum] = 0;
	for(i=n-2;i>=0;i--){
		//i以降を正の昇順にするために必要な回数
		ans = 0;
		if(x[i] <= x[i+1]){
			posi[i] = posi[i+1];
			num = 0;
			a = x[i];
			b = x[i+1];
			while(a * 4 < b){
				a *= 4;
				num++;
			}
			if(num == 0){
				len[snum]++;
			}else{
				snum++;
				len[snum] = 1;
				dep[snum] = dep[snum-1] - num;
			}
		}else{
			a = x[i];
			b = x[i+1];
			num = 0;
			while(a > b){
				b *= 4;
				num++;
			}
			num += dep[snum];
			for(j=snum;j>=0;j--){
				if(num > dep[j]){
					ans += (num - dep[j]) * len[j];
					dep[j] = num;
				}else{
					break;
				}
			}
			c = 0;
			a = snum;
			while(dep[snum] == num && snum >= 0){
				c += len[snum];
				len[snum] = 0;
				dep[snum] = 0;
				snum--;
			}
			if(snum == -1){
				snum = 0;
				len[snum] = c + 1;
				dep[snum] = num;
			}else{
				snum ++;
				len[snum] = c + 1;
				dep[snum] = num;
			}
		}
		posi[i] = posi[i+1] + ans * 2;
		ans = 0;
	}
	nega[0] = 0;
	snum = 0;
	len[snum] = 1;
	dep[snum] = 0;
	for(i=1;i<n;i++){
		//iまでを正の降順にするために必要な回数
		ans = 0;
		if(x[i-1] >= x[i]){
			nega[i] = nega[i-1];
			num = 0;
			a = x[i-1];
			b = x[i];
			while(a > b * 4){
				b *= 4;
				num++;
			}
			if(num == 0){
				len[snum]++;
			}else{
				snum++;
				len[snum] = 1;
				dep[snum] = dep[snum-1] - num;
			}
		}else{
			a = x[i-1];
			b = x[i];
			num = 0;
			while(a < b){
				a *= 4;
				num++;
			}
			num += dep[snum];
			for(j=snum;j>=0;j--){
				if(num > dep[j]){
					/*if(i == 2){
						p("-----");
						pe(num - dep[j]);
						p(len[j]);
						p("-----");
					}*/
					ans += (num - dep[j]) * len[j];
					dep[j] = num;
				}else{
					break;
				}
			}
			c = 0;
			a = snum;
			while(dep[snum] == num && snum >= 0){
				c += len[snum];
				len[snum] = 0;
				dep[snum] = 0;
				snum--;
			}
			if(snum == -1){
				snum = 0;
				len[snum] = c + 1;
				dep[snum] = num;
			}else{
				snum ++;
				len[snum] = c + 1;
				dep[snum] = num;
			}
		}
		nega[i] = nega[i-1] + ans * 2;
		ans = 0;
	}
	ans = posi[0];
	for(i=0;i<n-1;i++){
		ans = min(ans,nega[i] + posi[i+1] + i + 1);
	}
	ans = min(ans,nega[n-1] + n -1);
	/*
	for(i=0;i<n;i++){
		pe(i);p(posi[i]);
	}

	for(i=0;i<n;i++){
		pe(i);p(nega[i]);
	}
	*/
	p(ans);
    return 0;
}

Measured memory_bytes: 38528