#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
/* clang-format on */

template <class I>
class SegmentTree {
 public:
  using Op = function<I(const I&, const I&)>;

 private:
  int n;
  vector<I> dat;
  Op op;
  I e;

 public:
  SegmentTree(int n_, const Op& op, const I& e) : op(op), e(e) {
    n = 1;
    while (n < n_) n *= 2;
    dat.resize(2 * n - 1, e);
  }
  SegmentTree(const vector<I>& init, const Op& op, const I& e)
      : SegmentTree(init.size(), op, e) {
    for (int i = 0; i < init.size(); i++) {
      dat[i + n - 1] = init[i];
    }
    for (int i = n - 2; i >= 0; i--) {
      dat[i] = op(dat[i * 2 + 1], dat[i * 2 + 2]);
    }
  }
  const I& operator[](int k) const { return dat[k + n - 1]; }
  void update(int k, const I& a) {
    k += n - 1;
    dat[k] = op(dat[k], a);
    while (k > 0) {
      k = (k - 1) / 2;
      dat[k] = op(dat[k * 2 + 1], dat[k * 2 + 2]);
    }
  }
  // [a, b)
  I query(int a, int b) const {
    a += n - 1;
    b += n - 1;
    I vl = e;
    I vr = e;
    while (a < b) {
      if ((a & 1) == 0) vl = op(vl, dat[a]);
      if ((b & 1) == 0) vr = op(dat[b - 1], vr);
      a = a / 2;
      b = (b - 1) / 2;
    }
    return op(vl, vr);
  }
  // query(0, i) >= x となる最小のi
  int kth(const I& x) const {
    int k = 0;
    I v = e;
    while (k < n - 1) {
      I t = op(v, dat[k * 2 + 1]);
      if (x <= t) {
        k = k * 2 + 1;
      } else {
        v = t;
        k = k * 2 + 2;
      }
    }
    return k - (n - 1) + 1;
  }
};

int lg(ll A, ll B) {
  if (A == B) return 0;
  if (A < B) {
    int res = 0;
    while (A * 4 <= B) {
      res += 2;
      A *= 4;
    }
    return -res;
  } else {
    int res = 0;
    while (A > B) {
      res += 2;
      B *= 4;
    }
    return res;
  }
}

ll naive(const vector<ll>& A) {
  int N = A.size();
  ll res = 1ll << 60;
  for (int i = 0; i <= N; i++) {
    ll cost = 0;
    cost += i;  // i未満を全部負にする
    ll e = 0;
    for (int j = i - 2; j >= 0; j--) {
      e += lg(A[j + 1], A[j]);
      if (e < 0) e = 0;
      cost += e;
    }
    for (int j = i + 1; j < N; j++) {
      e += lg(A[j - 1], A[j]);
      if (e < 0) e = 0;
      cost += e;
    }
    res = min(res, cost);
  }
  return res;
}

int bit = 40;
int MAX = 200010;
int sz = bit * MAX * 2 + 10;
int geta = sz / 2;

vector<ll> solve(const vector<ll>& A) {
  int N = A.size();
  vector<ll> d(N - 1);
  for (int i = 0; i < N - 1; i++) d[i] = lg(A[i], A[i + 1]);
  vector<ll> pref1(N, 0);
  for (int i = 1; i < N; i++) pref1[i] = pref1[i - 1] + d[i - 1];
  vector<ll> pref2(N + 1, 0);
  for (int i = 1; i < N + 1; i++) pref2[i] = pref2[i - 1] + pref1[i - 1];
  // dp[i] = A_iをそのままに残りを昇順にする場合の最小コスト
  vector<ll> dp(N + 1, 0);
  SegmentTree<int> seg(sz, [](int a, int b) { return min(a, b); }, N);
  int sum = geta;
  seg.update(sum, N - 1);
  for (int i = N - 2; i >= 0; i--) {
    sum += d[i];
    int k = seg.query(sum, sz);
    ll add = pref2[k] - pref2[i + 1];
    add -= (k - i - 1) * (pref1[i]);
    dp[i] = dp[k] + add;
    seg.update(sum, i);
  }
  return dp;
}

int main() {
  int N;
  while (cin >> N) {
    vector<ll> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];
    vector<ll> B = A;
    reverse(B.begin(), B.end());
    vector<ll> costA = solve(A);
    vector<ll> costB = solve(B);
    reverse(costB.begin(), costB.end());
    ll res = 1ll << 60;
    for (int i = 0; i < costA.size(); i++) {
      ll cost = i + costB[i] + costA[i];
      res = min(res, cost);
    }
    cout << res << endl;
  }
  return 0;
}


Measured memory_bytes: 142248