// Reads multiple ints in a line, separate by a space.
// It works even if the actual number of ints is smaller than n.
// WARNING: This function does not work for -2^63.
// NOTE: This function does not handle error cases.
// Verified: ARC096D
fun fastReadLongs(n: Int): LongArray {
  val xs = LongArray(n)
  val s = readLine()!!
  var currentValue = 0L
  var isNegative = false
  var currentIndex = 0
  for (c in s) {
    if (c == ' ') {
      xs[currentIndex] = currentValue * if (isNegative) -1L else 1L
      currentValue = 0
      isNegative = false
      currentIndex++
    } else if (c == '-') {
      isNegative = true
    } else {
      currentValue *= 10
      currentValue += c - '0'
    }
  }
  xs[currentIndex] = currentValue * if (isNegative) -1L else 1L
  return xs
}

// Compute c to make x1 * 2^p <= x2 * 2^(p + c)
fun cost(x1: Long, x2: Long): Int {
  if (x1 == x2) return 0
  if (x2 < x1) {
    var c = 0
    var currentX2 = x2
    while (currentX2 < x1) {
      c += 2
      currentX2 *= 4
    }
    return c
  }
  // x1 < x2
  var c = 0
  var currentX1 = x1
  while (4 * currentX1 <= x2) {
    c -= 2
    currentX1 *= 4
  }
  return c
}

fun solveDP(n: Int, xs: LongArray): LongArray {
  // Solve all positive case.
  val M = 100
  // dp[k][i]: The cost to solve [i, n) when the cost at i is 2 * k.
  var dp = Array(M + 1, { LongArray(n) })
  for (i in n - 1 downTo 0) {
    if (i == n - 1) {
      for (k in 0..M) {
        dp[k][i] = 2L * k
      }
    } else {
      for (k in 0..M) {
        val k2 = k + cost(xs[i], xs[i + 1]) / 2
        if (0 <= k2 && k2 <= M) {
          dp[k][i] = 2 * k + dp[k2][i + 1]
        } else if (k2 < 0) {
          dp[k][i] = 2 * k + dp[0][i + 1]
        } else {
          // k2 > M
          dp[k][i] = 2 * k + (n - i - 1) * 2 * (k2 - M) + dp[M][i + 1]
        }
      }
    }
  }
//  println(dp[0].toList())
//  println(dp[1].toList())
  return dp[0]
}

fun main(args: Array<String>) {
//  println(cost(5, 16))
//  println(cost(4, 16))
//  println(cost(3, 16))
//  println(cost(16, 3))
//  println(cost(16, 4))
//  println(cost(16, 5))
  val n = readLine()!!.toInt()
  val xs = fastReadLongs(n)

  val dp1 = solveDP(n, xs)
  val ys = xs.reversedArray()
  val dp2 = solveDP(n, ys)

  var min = dp1[0]

  for (i in 1 until n) {
    // First i is negative, then positive
    val cost = i + dp2[n - i] + dp1[i]
    min = Math.min(min, cost)
  }

  // All negative
  min = Math.min(min, n + dp2[0])

  println(min)
}

