use std::io::*;
use std::str::FromStr;
use utils::*;

pub fn main() {
    let i = stdin();
    let mut o = Vec::new();
    run(i.lock(), &mut o);
    stdout().write_all(&o).unwrap();
}

fn run<R: BufRead, W: Write>(i: R, o: &mut W) {
    let mut i = CpReader::new(i);
    let n = i.read::<usize>();
    let a = i.read_vec::<usize>(n);

    writeln!(o, "{}", solve(a)).unwrap();
}
fn solve(a: Vec<usize>) -> usize {
    struct Solver {
        a: Vec<usize>,
        m: Vec<Vec<Option<usize>>>,
    }
    impl Solver {
        fn new(a: Vec<usize>) -> Self {
            let len = a.len();
            Solver {
                a: a,
                m: vec![vec![None; len]; 16],
            }
        }
        // i-1番目(0-origin)の項目をc回4倍して、
        // j in [0,i-1) の項目の絶対値を |a[j]| >= |a[j+1]| にするための `4倍の 適用回数` を返す
        fn get(&mut self, i: usize, c: usize) -> usize {
            if i == 0 {
                return 0;
            }
            if i == 1 {
                return c;
            }

            if c >= self.m.len() {
                let d = c - self.m.len() + 1;
                return self.get(i, c - d) + d * i;
            }
            if let Some(value) = self.m[c][i - 2] {
                return value;
            }
            let mut c_next = c;
            let mut a0 = self.a[i - 2];
            let mut a1 = self.a[i - 1];
            while a0 < a1 {
                a0 *= 4;
                c_next += 1;
            }
            while c_next > 0 && a0 >= a1 * 4 {
                a1 *= 4;
                c_next -= 1;
            }
            let value = c + self.get(i - 1, c_next);
            self.m[c][i - 2] = Some(value);
            value
        }
    }
    let a_len = a.len();

    let a0 = a.clone();
    let mut a1 = a.clone();
    a1.reverse();

    let mut s0 = Solver::new(a0);
    let mut s1 = Solver::new(a1);

    (0..a_len)
        .map(|x| s0.get(x, 0) * 2 + x + s1.get(a_len - x, 0) * 2)
        .min()
        .unwrap()
}

mod utils {
    use super::*;

    pub struct CpReader<R: BufRead> {
        r: R,
        s: String,
    }

    macro_rules! fn_read {
        { $f:ident($($t:ident),*) } => {
            #[allow(dead_code)]
            pub fn $f<$($t: FromStr),*>(&mut self) -> ($($t),*) {
                let i = &mut self.read_line().split(' ');
                ($(read_next::<$t,_>(i)),*)
            }
        };
    }

    impl<R: BufRead> CpReader<R> {
        pub fn new(r: R) -> Self {
            CpReader {
                r: r,
                s: String::new(),
            }
        }
        pub fn read_line(&mut self) -> &str {
            self.s.clear();
            self.r.read_line(&mut self.s).unwrap();
            self.s.trim()
        }

        pub fn read<T: FromStr>(&mut self) -> T {
            self.read_line().parse().ok().unwrap()
        }
        fn_read! { read2(T1, T2) }
        fn_read! { read3(T1, T2, T3) }
        fn_read! { read4(T1, T2, T3, T4) }
        fn_read! { read5(T1, T2, T3, T4, T5) }

        pub fn read_vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
            self.read_line()
                .split(' ')
                .take(n)
                .map(|x| x.parse().ok().unwrap())
                .collect()
        }
    }
    fn read_next<'a, T: FromStr, I: Iterator<Item = &'a str>>(i: &mut I) -> T {
        i.next().unwrap().parse().ok().unwrap()
    }

}


Measured memory_bytes: 169592