#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
 
#define ll long long
#define ull unsigned long long
#define db long double
#define pb push_back
#define ppb pop_back
#define F first
#define S second
#define mp make_pair
#define all(x) (x).begin(), (x).end()

#define int long long

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef array <int, 2> pii;
typedef vector <int> vi;

typedef tree <pii, null_type, less <pii>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const int N = 2e5 + 123, inf = 1e12;
int n, a[N], b[2][N], pref[N], suf[N];

int get(ll x, ll y) {
	int sign = 1;
	if (x > y) {
		sign = -1;
	}
	int res = 0;
	if (sign == -1) {
		while (y < x) {
			y *= 4;
			res++;
		}
	}	else {
		while (x * 4 <= y) {
			x *= 4;
			res++;
		}
	}
	return sign * res;
}

struct Node {
	int l = 0, r = 0;
	int s = 0, mx = 0, mn = 0, lazy = 0, lazy2 = 0;
	void clear() {
		s = 0, mx = 0, mn = 0, lazy = 0, lazy2 = 0;
	}
	void merge(const Node & x, const Node & y) {
		l = x.l, r = y.r;
		s = x.s + y.s;
		mx = max(x.mx, y.mx);
		mn = min(x.mn, y.mn);
	}
	void upd(int x) {
		mx += x;
		mn += x;
		s += (r - l + 1) * x;
		lazy += x;
	}
	void reset() {
		lazy2 = 1;
		mn = 0, mx = 0, s = 0, lazy = 0;
	}
};

Node t[(1 << 19) + 1];

void build(int v, int l, int r) {
	t[v].l = l, t[v].r = r;
	t[v].clear();
	if (l == r) {
		return;
	}
	int m = l + r >> 1;
	build(v << 1, l, m);
	build(v << 1 | 1, m + 1, r);
}

void push(int v) {
	if (t[v].lazy2) {
		t[v << 1].reset();
		t[v << 1 | 1].reset();
		t[v].lazy2 = 0;
	}
	if (t[v].lazy) {
		t[v << 1].upd(t[v].lazy);
		t[v << 1 | 1].upd(t[v].lazy);
		t[v].lazy = 0;
	}
}

int update(int v, int pos, int x) {
	if (t[v].r < pos) {
		return 0;
	}
	if (t[v].l >= pos && t[v].mn >= x) {
		t[v].upd(-x);
		return 0;
	}
	if (t[v].l >= pos && t[v].mx < x) {
		int res = x * (t[v].r - t[v].l + 1) - t[v].s;
		t[v].reset();
		return res;
	}
	push(v);
	int res = update(v << 1, pos, x) + update(v << 1 | 1, pos, x);
	t[v].merge(t[v << 1], t[v << 1 | 1]);
	return res;
}

void add(int v, int l, int r, int x) {
	if (t[v].l > r || t[v].r < l) {
		return;
	}
	if (t[v].l >= l && t[v].r <= r) {
		t[v].upd(x);
		return;
	}
	push(v);
	add(v << 1, l, r, x);
	add(v << 1 | 1, l, r, x);
	t[v].merge(t[v << 1], t[v << 1 | 1]);
}

signed main() {
	ios_base::sync_with_stdio(false), cin.tie(NULL);
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
	#endif
	
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	build(1, 1, n);
	for (int i = 1; i <= n; i++) {
		if (i > 1) {
			b[1][i] = get(a[i], a[i - 1]);
		}	else {
			b[1][i] = inf;
		}
		pref[i] = pref[i - 1];
		if (b[1][i] < 0) {
			pref[i] += update(1, n - i + 1, -b[1][i]);
		}	else if (b[1][i] > 0) {
			add(1, n - i + 1, n, b[1][i]);
		}
	}
	build(1, 1, n);
	for (int i = n; i >= 1; i--) {
		if (i < n) {
			b[0][i] = get(a[i], a[i + 1]);
		}	else {
			b[0][i] = inf;
		}
		suf[i] = suf[i + 1];
		if (b[0][i] < 0) {
			suf[i] += update(1, i, -b[0][i]);
		}	else if (b[0][i] > 0) {
			add(1, i, n, b[0][i]);
		}
	}
	int res = inf;
	for (int i = 0; i <= n; i++) {
		res = min(res, (pref[i] + suf[i + 1]) * 2 + i);
	}
	cout << res;
}


Measured memory_bytes: 36736