#pragma GCC optimize("Ofast")

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;

#define X first
#define Y second

//#include <boost/unordered_map.hpp>
//using namespace boost;

/*
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> rbtree;
rbtree T;
*/

namespace io{
	const int L = (1 << 20) + 1;
	
	char buf[L], *S , *T, c;
	 
	char getchar() {
		if(__builtin_expect(S == T, 0)) {
			T = (S = buf) + fread(buf, 1, L, stdin);
			return (S == T ? EOF : *S++);
		}
		return *S++;
	}
	
	int inp() {
		int x = 0, f = 1; char ch;
		for(ch = getchar(); !isdigit(ch); ch = getchar())
			if(ch == '-') f = -1;
		for(; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
		return x * f;
	}
	
	unsigned inpu()
	{
		unsigned x = 0; char ch;
		for(ch = getchar(); !isdigit(ch); ch = getchar());
		for(; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
		return x;
	}
	
	ll inp_ll() {
		ll x = 0; int f = 1; char ch;
		for(ch = getchar(); !isdigit(ch); ch = getchar())
			if(ch == '-') f = -1;
		for(; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
		return x * f;
	}
	
	char B[25], *outs=B+20, *outr=B+20;
	template<class T>
	inline void print(register T a,register char x=0){
		if(x) *--outs = x, x = 0;
		
		if(!a)*--outs = '0';
		else 
			while(a)
				*--outs = (a % 10) + 48, a /= 10;
		
		if(x)
			*--outs = x;
		
		fwrite(outs, outr - outs , 1, stdout);
		outs = outr;
	}
};

using io :: print;
using io :: inp;
using io :: inpu;
using io :: inp_ll;

using i32 = int;
using i64 = long long;
using u8 = unsigned char;
using u32 = unsigned;
using u64 = unsigned long long;
using f64 = double;
using f80 = long double;

ll power(ll a, ll b, ll p)
{
	if (!b) return 1;
	ll t = power(a, b/2, p);
	t = t*t%p;
	if (b&1) t = t*a%p;
	return t;
}

const int MAXN = 200010;
const int MAXP = 10000000;
const u64 MOD = 1000000007;
const f80 MI = f80(1)/MOD;
const int INF = 1000000010;

int n;
int a[MAXN], b[MAXN];
ll Fa[MAXN], Fb[MAXN];

int e[MAXN];
ld x[MAXN];

int F[MAXN];
int delta[MAXN];

int father(int x)
{
	return F[x] == x ? x : F[x] = father(F[x]);
}

int merge(int x, int y)
{
	F[father(x)] = father(y);
}

void solve(int *a, int b, ll *F)
{
	for (int i = 1; i <= n; ++ i)
	{
		e[i] = 0;
		x[i] = a[i];
		while (x[i] >= 1)
		{
			x[i] /= 4;
			e[i] ++;
		}
	}
	
	for (int i = 1; i <= n; ++ i)
		::F[i] = i;
	
	F[n] = 0;
	for (int i = n-1; i >= 1; -- i)
	{
		if (a[i] <= a[i+1])
		{
			F[i] = F[i+1];
			ll t = a[i];
			int c = 0;
			while (t <= a[i+1])
			{
				c ++;
				t *= b;
			}
			delta[i] = c-1;
			if (delta[i] == 0)
				merge(i, i+1);
			continue;
		}
		F[i] = F[i+1];
		ll t = a[i+1];
		int c = 0;
		while (a[i] > t)
		{
			c ++;
			t *= b;
		}
		int j = i+1;
		while (c)
		{
			j = father(j);
			if (j == n)
			{
				F[i] += (ll)c*(n-i);
				break;
			}
			int gap = min(delta[j], c);
			F[i] += (ll)gap*(j-i);
			c -= gap;
			delta[j] -= gap;
			if (delta[j] == 0)
				merge(j, j+1);
			j ++;
		}
		merge(i, i+1);
	}
}

int main()
{
	
	cin >> n;
	for (int i = 1; i <= n; ++ i)
	{
		scanf("%d", &a[i]);
		b[n-i+1] = a[i];
	}
	solve(a, 4, Fa);
	solve(b, 4, Fb);
	
	ll ans = 10000000000000000LL;
	for (int i = 1; i <= n+1; ++ i)
	{
		ll tmp = Fa[i]*2+(i-1)+Fb[n-(i-1)+1]*2;
		ans = min(ans, tmp);
	}
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 10496