#include <bits/stdc++.h>

#if MYDEBUG
#include "lib/cp_debug.hpp"
#else
#define DBG(...) ;
#endif
#if __cplusplus <= 201402L
template <typename T>
T gcd(T a, T b) { return ((a % b == 0) ? b : gcd(b, a % b)); }
template <typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }
#endif
using LL = long long;
constexpr LL LINF = 334ll << 53;
constexpr int INF = 15 << 26;
constexpr LL MOD = 1E9 + 7;

namespace Problem {
using namespace std;

class Solver {
 public:
  int n;
  vector<LL> a;
  vector<LL> cntr, cntl;
  Solver(LL n) : n(n), a(n), cntr(n), cntl(n){};
  pair<LL, LL> divs(LL a, LL b, LL c) {
    int ret = 0;
    while (a > b) {
      b *= 4;
      c *= 4;
      c = min(c, LINF / 4);
      ret += 2;
    }
    return {ret, c};
  }
  vector<LL> calc(vector<LL> v) {
    DBG(n, v)
    vector<LL> ret(n);
    deque<pair<pair<LL, LL>, int>> Q;
    Q.push_back({{v[n - 1], LINF / 4}, n - 1});
    ret[n - 1] = 0;
    for (int i = n - 2; i >= 0; --i) {
      LL tmp = 0;
      DBG(i, Q)
      if (v[i] <= Q[0].first.first) {
        if (v[i] * 4 <= Q[0].first.first) {
          Q.push_front({{v[i], v[i]}, i});
        } else {
          //Q[0] = {v[i], i};
          Q[0].first.first = v[i];
          Q[0].second = i;
        }
      } else {
        LL now = v[i];
        while (Q.size() > 0 && now > Q[0].first.first) {
          auto res = divs(now, Q[0].first.first, Q[0].first.second);
          DBG(res)
          if (Q.size() > 1) {
            tmp += res.first * (Q[1].second - Q[0].second);
          } else {
            tmp += res.first * (n - Q[0].second);
          }
          now = res.second;
          Q.pop_front();
        }
        if (Q.size() == 0) {
          Q.push_back({{a[i], LINF / 4}, i});
        } else {
          if (now * 4 <= Q[0].first.first) {
            Q.push_front({{a[i], now}, i});
          } else {
            Q[0].first.first = a[i];
            Q[0].second = i;
          }
        }
      }
      ret[i] = ret[i + 1] + tmp;
      DBG(i, Q, ret)
    }
    return ret;
  }
  void solve() {
    for (int i = 0; i < n; ++i) {
      cin >> a[i];
    }
    /*deque<pair<LL, int>> Q;
    Q.push_back({a[n - 1], n - 1});
    ret[n - 1] = 0;
    for (int i = n - 2; i >= 0; --i) {
      if (a[i] <= Q[0].first) {
        if (a[i] * 4 < Q[0].first) {
          Q.push_front({a[i], i});
        } else {
          Q[0] = {a[i], i};
        }
      } else {
        LL tmp = 0;
        LL now = a[i];
        while (Q.size() > 0 && now > Q[0].first) {
          auto res = divs(now, Q[0].first);
          if (Q.size() > 1) {
            tmp += res.first * (Q[1].second - Q[0].second);
          } else {
            tmp += res.first * (n - Q[0].second);
          }
          now = res.second;
          Q.pop_front();
        }
        if (Q.size == 0) {
          Q.push_back({now, i});
        } else {
          if (now * 4 < Q[0].first) {
            Q.push_front({now, i});
          } else {
            Q[0] = {now, i};
          }
        }
        cntr[i] = cntr[i + 1] + tmp;
      }
    }*/
    cntr = calc(a);
    reverse(a.begin(), a.end());
    for (int i = 0; i < n; ++i) {
      //a[i] = -a[i];
    }
    cntl = calc(a);
    cntl.push_back(0);
    LL ans = LINF;
    for (int i = 0; i < n; ++i) {
      DBG(cntr[i] + cntl[n - i] + i)
      ans = min(ans, cntr[i] + cntl[n - i] + i);
    }
    cout << ans << endl;
  }
};  // namespace Problem

}  // namespace Problem

int main() {
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(false);
  // std::cout << std::fixed << std::setprecision(12);
  long long n = 0;
  std::cin >> n;

  Problem::Solver sol(n);
  sol.solve();
  return 0;
}


Measured memory_bytes: 9644