#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
//#define revstr(s) reverse(s.begin(),s.end())
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
typedef unsigned long long ul;

int n; ll a[1 << 18]; ll cnt[1 << 18];

ll sum[1 << 18];
ll aum[1 << 18];



int nex[1 << 18];
ll gen[1 << 18]; bool used[1 << 18];
ll dfs(int id) {
	if (used[id])return gen[id];
	if (id == n)return gen[id] = 0;
	used[id] = true;
	int to = nex[id];
	ll res = (to - id)*sum[id] + dfs(to);
	return gen[id] = res;
}
void initt() {
	priority_queue<LP> q;
	rep1(i, n - 1) {
			while (!q.empty()) {
				LP ne = q.top();
				if (ne.first > sum[i]) {
					nex[ne.second] = i; q.pop();
				}
				else {
					break;
				}
			}
			q.push({ sum[i],i });
	}
	while (!q.empty()) {
		P ne = q.top();q.pop();
		nex[ne.second] = n;
	}
	rep1(i, n - 1) {
		dfs(i);
	}
}
ll invaum[1 << 18];
ll invcnt[1 << 18];
ll invsum[1 << 18];

int invnex[1 << 18];
ll invgen[1 << 18]; bool invused[1 << 18];
ll invdfs(int id) {
	if (id < 0)return 0;
	if (invused[id])return invgen[id];
	invused[id] = true;
	int to = invnex[id];
	ll res = (id - to)*invsum[id] + invdfs(to);
	return invgen[id] = res;
}
void invinitt() {
	priority_queue<LP> q;
	per(i, n - 1) {
		while (!q.empty()) {
			LP ne = q.top();
			if (ne.first > invsum[i]) {
				invnex[ne.second] = i; q.pop();
			}
			else {
				break;
			}
		}
		q.push({ invsum[i],i });
	}
	while (!q.empty()) {
		P ne = q.top(); q.pop();
		invnex[ne.second] = -1;
	}
	//cout << invnex[1] << endl;
	per(i, n - 1) {
		invdfs(i);
	}
}

int main() {
	cin >> n;
	rep(i, n)cin >> a[i];
	rep(i, n - 1) {
		int c = 0;
		ll x = a[i], y = a[i + 1];
		if (a[i] > a[i + 1]) {
			while (x > y) {
				y *= 4; c += 2;
			}
		}
		else{
			while (x <= y) {
				x *= 4; c -= 2;
			}
			c += 2;
		}
		cnt[i] = c; //cout << c << endl;
	}
	per(i, n - 1) {
		int c = 0;
		ll x = a[i], y = a[i + 1];
		if (a[i] < a[i + 1]) {
			while (x < y) {
				x *= 4; c += 2;
			}
		}
		else{
			while (x >= y) {
				y *= 4; c -= 2;
			}
			c += 2;
		}
		invcnt[i] = c;
	}
	sum[0] = 0;
	rep(i, n - 1) {
		sum[i + 1] = max(sum[i] + cnt[i],(ll)0);
		//invsum[i + 1] = max(invsum[i] + invcnt[i], (ll)0);
		//cout << i + 1 << " " << sum[i + 1] << endl;
	}
	per(i, n - 1) {
		invsum[i] = max(invsum[i + 1] + invcnt[i], (ll)0);
	}
	rep(i, n-1) {
		//cout << i << " " << invsum[i] << endl;
	}
	initt(); invinitt();
	rep(i, n - 1) {
		aum[i + 1] = aum[i] + sum[i+1];
		//invaum[i + 1] = invaum[i] + invsum[i + 1];
	}
	per(i, n - 1) {
		invaum[i] = invaum[i+1] + invsum[i];
	}
	ll ans = aum[n-1];
	rep(i, n) {
		ll csum = 0;
		csum += i + 1;
		csum += invaum[0]-invaum[i+1]-invgen[i];
		csum += aum[n-1] - aum[i] - gen[i+1];
		/*cout << i << " " << aum[n - 1] - aum[i] - gen[i + 1] << endl;
		cout << i << " " << invaum[0] - invaum[i] - invgen[i] << endl;*/
		//cout << i << " " << csum << endl;
		ans = min(ans, csum);
	}
	/*rep1(i, n - 1) {
		cout << i << " " << gen[i] << endl;
	}
	
	rep(i, n - 1) {
		cout << i << " " << invgen[i] << endl;
	}*/
	cout << ans << endl;
	/*cout << invnex[1] << endl;
	cout << invgen[1] << invdfs(1) << endl;*/
	return 0;
}

Measured memory_bytes: 28780