#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int n;
int a[252521];

ll rcnt[252521], lcnt[252521];

pll mk(ll a, ll b){
  while(a>0 && a%4==0){
    b++;a/=4;
  }
  return pll(a,b);
}
bool lss(pll a, pll b){
  ll x = a.first, s = a.second;
  ll y = b.first, t = b.second;
  if(t-s>=16)return true;
  if(s-t>=16)return false;
  if(t-s>=0)return x <= (y<<(2*(t-s)));
  return (x<<(2*(s-t))) <= y;
}

int main(){
  scanf("%d",&n);
  REP(i,n)scanf("%d",a+i);
  // right
  {
    stack<int> cussion;
    rcnt[n-1] = 0;
    cussion.push(1);
    pll head = mk(a[n-1], 1);
    FORR(i,0,n-1){
      pll cur = mk(a[i], 1);
      ll need = 0;
      while(!lss(cur,head)){
        need++;
        head.second++;
      }
      ll space = 0;
      while(true){
        head.second--;
        if(!lss(cur,head))break;
        space++;
      }
      head = cur;
      rcnt[i] = rcnt[i+1];
      if(need>0){
        ll tmp = 0;
        while(true){
          tmp += cussion.top(); cussion.pop();
          if(cussion.size()==0){
            cussion.push(0);
            break;
          }
          ll sp = -cussion.top(); cussion.pop();
          ll sub = min(need, sp);
          sp -= sub; need -= sub;
          rcnt[i] += sub*tmp;
          if(sp>0){
            cussion.push(-sp);
            cussion.push(0);
            break;
          }
        }
        rcnt[i] += need*tmp;
        cussion.top() += tmp;
      }
      if(space > 0){
        cussion.push(-space);
        cussion.push(1);
      }else{
        cussion.top() += 1;
      }
    }
  }
  // left
  REP(i,n)a[i]*=2;
  reverse(a,a+n);
  {
    stack<int> cussion;
    lcnt[n-1] = 0;
    cussion.push(1);
    pll head = mk(a[n-1], 1);
    FORR(i,0,n-1){
      pll cur = mk(a[i], 1);
      ll need = 0;
      while(!lss(cur,head)){
        need++;
        head.second++;
      }
      ll space = 0;
      while(true){
        head.second--;
        if(!lss(cur,head))break;
        space++;
      }
      // DEBUG(cur.first);DEBUG(cur.second);
      // DEBUG(need);DEBUG(space);
      head = cur;
      lcnt[i] = lcnt[i+1];
      if(need>0){
        ll tmp = 0;
        while(true){
          tmp += cussion.top(); cussion.pop();
          if(cussion.size()==0){
            cussion.push(0);
            break;
          }
          ll sp = -cussion.top(); cussion.pop();
          ll sub = min(need, sp);
          sp -= sub; need -= sub;
          lcnt[i] += sub*tmp;
          if(sp>0){
            cussion.push(-sp);
            cussion.push(0);
            break;
          }
        }
        lcnt[i] += need*tmp;
        cussion.top() += tmp;
      }
      if(space > 0){
        cussion.push(-space);
        cussion.push(1);
      }else{
        cussion.top() += 1;
      }
    }
  }
  ll ans = 1ll<<60;
  reverse(lcnt,lcnt+n+1);
  REP(i,n+1)CHMIN(ans, 2*(lcnt[i]+rcnt[i])+i);
  printf("%lld\n",ans);
  return 0;
}


Measured memory_bytes: 4608