#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstring>
using namespace std;
typedef long long LL;
const LL N=200005;
const LL MAX=1e18;
LL n,a[N];
LL suf[N],pre[N];
LL calc (LL x,LL y,LL op)
{
	LL cnt=0;
	while (y<x)	{y*=4;cnt+=2;}
	if (x==y&&op==1) cnt+=2;
	return cnt;
}
LL calc1 (LL x,LL y,LL op)
{
	LL cnt=0;
	while (y>x)	{y*=4;cnt+=2;}
	if (x==y&&op==1) cnt+=2;
	return cnt;
}
LL sta[N],top,sta1[N];
int main()
{
	scanf("%lld",&n);
	for (LL u=1;u<=n;u++) scanf("%lld",&a[u]);
	suf[n]=0;top=0;sta[top]=MAX;sta1[top]=n+1;
	for (LL u=n-1;u>=1;u--) 
	{
		suf[u]=suf[u+1];
		if (a[u+1]>a[u])
		{
			sta[++top]=calc(a[u+1],a[u],1)-2;
			sta1[top]=u+1;
		}
		else
		{
			LL t=calc(a[u],a[u+1],0);
			LL now=u;
			suf[u]=suf[u]+t*(sta1[top]-now-1);
			//printf("%lld %lld %lld %lld\n",u,t,sta1[top],now);
			now=sta1[top]-1;
			while (top>0&&sta[top]<t)	
			{
				t=t-sta[top];
				top--;
				//printf("%lld %lld %lld %lld\n",u,t,sta1[top],now);
				suf[u]=suf[u]+t*(sta1[top]-now-1);
				now=sta1[top]-1;
			}
			sta[top]-=t;
		}
	}
/*	for (int u=1;u<=n;u++)  printf("%lld ",suf[u]);
	printf("\n");*/
	for (LL u=1;u<=n;u++) a[u]=-2*a[u];
	top=0;sta[top]=MAX;sta1[top]=0;
	pre[1]=0;
	for (LL u=2;u<=n;u++) 
	{
		pre[u]=pre[u-1];
		if (a[u]>a[u-1])
		{
			sta[++top]=calc1(a[u-1],a[u],1)-2;
			sta1[top]=u-1;
		}
		else
		{
			LL t=calc1(a[u],a[u-1],0);
			LL now=u;
			//printf("%lld %lld %lld %lld\n",u,t,a[u],a[u-1]);
			pre[u]=pre[u]+t*(now-sta1[top]-1);
			now=sta1[top]+1;
			while (top>0&&sta[top]<t)	
			{
				t=t-sta[top];
				top--;
				pre[u]=pre[u]+t*(now-sta1[top]-1);
				now=sta1[top]+1;
			}
			sta[top]-=t;
		}
	}
/*	for (int u=1;u<=n;u++)  printf("%lld ",pre[u]);
	printf("\n");*/
	LL ans=suf[1];
	for (LL u=2;u<=n+1;u++) ans=min(ans,pre[u-1]+u-1+suf[u]);
	printf("%lld\n",ans);
	return 0;
}