#include <bits/stdc++.h>

using namespace std;
#define sz(a) (int)(a).size()
#define rep(i, a, b) for (int i = (a), _b = (b); i < _b; ++i)
#define debug(a) cerr << #a << ": " << (a) << '\n';
#define debug_arr(arr, n) { cerr << #arr << " "; rep(i, 0, n) cerr << arr[i] << " \n"[i == n]; }
#define debug_two(a, b) cerr << #a << ": " << (a) << ", " << #b << ": " << (b) << '\n';

template <typename num_t>
inline void addmod(num_t& a, const long long& b, const int& m) { a = (a + b) % m; if (a < 0) a += m; }
template <typename num_t>
inline void update_max(num_t& a, const num_t& b) { a = max(a, b); }
template <typename num_t>
inline void update_min(num_t& a, const num_t& b) { a = min(a, b); }
template <typename num_t>
num_t gcd(num_t lhs, num_t rhs) { return !lhs ? rhs : gcd(rhs % lhs, lhs); }
template <typename num_t>
num_t pw(num_t n, num_t k, num_t mod) {
  num_t res = 1; for (; k > 0; k >>= 1) { if (k & 1) res = 1ll * res * n % mod; n = 1ll * n * n % mod; } return res;
}

typedef long long ll;
const int inf = 1e9 + 7;
const int mod = 998244353 ;
const int MAX_N = 200000 + 7;
const long long ll_inf = 9ll * inf * inf;

long long dp_left[MAX_N], dp_right[MAX_N];
int n;
vector<long long> a, b;

long long cnt_log(long long temp) {
  int res = 0;
  while (temp >= 4) {
    res += 2; temp >>= 2;
  }
  return res;
}

void solve() {
  cin >> n; b.assign(n + 2, 0);
  rep(i, 1, n + 1) cin >> b[i];

  vector<pair<long long, int>> stack_;
  long long sum = 0;
  a = b;
  for (int i = n; i > 0; --i) {
    if (i < n) {
      if (a[i] > a[i + 1]) {
        long long height = 0;
        while (a[i + 1] < a[i]) {
          a[i + 1] *= 4;
          height += 2;
        }
        sum += height;
        int cnt = 1;
        while (!stack_.empty() && stack_.back().first <= height) {
          height -= stack_.back().first;
          sum += height * stack_.back().second;
          cnt += stack_.back().second;
          stack_.pop_back();
        }
        if (!stack_.empty()) stack_.back().first -= height;
        stack_.push_back({ 0, cnt });
      } else {
        stack_.push_back({ cnt_log(a[i + 1] / a[i]), 1 });
      }
    }
    dp_right[i] = sum;
  }


  stack_.clear();
  sum = 0;
  a = b;
  for (int i = 1; i <= n; ++i) {
    a[i] *= 2;
    if (i > 1) {
      if (a[i] > a[i - 1]) {
        long long height = 0;
        while (a[i - 1] < a[i]) {
          a[i - 1] *= 4;
          height += 2;
        }
        sum += height;
        int cnt = 1;
        while (!stack_.empty() && stack_.back().first <= height) {
          height -= stack_.back().first;
          sum += height * stack_.back().second;
          cnt += stack_.back().second;
          stack_.pop_back();
        }
        if (!stack_.empty()) stack_.back().first -= height;
        stack_.push_back({ 0, cnt });
      } else {
        stack_.push_back({ cnt_log(a[i - 1] / a[i]), 1 });
      }
    }
    dp_left[i] = sum + i;
  }


//  for (int i = 1; i <= n; ++i) debug_two(i, dp_right[i]); cout << '\n';
//  for (int i = 1; i <= n; ++i) debug_two(i, dp_left[i]);

  long long res = ll_inf;
  for (int i = 0; i <= n; ++i) {
    update_min(res, dp_left[i] + dp_right[i + 1]);
  }
  cout << res << '\n';
}

int main() {
  ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef _LOCAL_
  freopen("in.txt", "r", stdin);
#endif
  const bool multiple_test = false;
  int test = 1;
  if (multiple_test)
    cin >> test;

  for(int i = 0; i < test; ++i) {
    //printf("Case #%d: ", i + 1);
    solve();
  }
#ifdef _LOCAL_
  cerr << "\n" << 1.0 * clock() / CLOCKS_PER_SEC << "\n";
#endif
}


Measured memory_bytes: 11376