program negative_doubling
  implicit none
  integer :: n, d(200000,2) = 0, dp(200000,0:15,2) = 0, m, i, j, x, y
  integer(8) :: a(200000) = 0_8, p, q
  read(*,*) n
  read(*,*) a(1:n)
  do j = 1, 2
    do i = 1, n-1
      p = a(i)
      q = a(i+1)
      if (p <= q) then
        do while (4_8*p <= q)
          d(i,j) = d(i,j)-1
          p = 4_8*p
        end do
      else
        do while (p > q)
          d(i,j) = d(i,j)+1
          q = 4_8*q
        end do
      end if
    end do
    a(1:n) = a(n:1:-1)
  end do
  do x = 0, 15
    dp(n,x,:) = 2*x
  end do
  do i = n-1, 1, -1
    do x = 0, 15
      do j = 1, 2
        y = max(x+d(i,j),0)
        if (y <= 15) then
          dp(i,x,j) = dp(i+1,y,j)+2*x
        else
          dp(i,x,j) = dp(i+1,15,j)+2*x+2*(y-15)*(n-i)
        end if
      end do
    end do
  end do
  dp(1:n,:,2) = dp(n:1:-1,:,2)
  m = min(dp(1,0,1),dp(n,0,2)+n)
  do i = 2, n
    m = min(m,dp(i,0,1)+dp(i-1,0,2)+i-1)
  end do
  write(*,'(i0)') m
  stop
end program negative_doubling