#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
int n = 0;
unsigned long long sum = 0;
int brr[200010] = { 0 };
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n;
int tp = 0, temp = 0;
cin >> tp;
for (int i = 1; i < n; i++)
{
cin >> temp;
brr[i] = brr[i - 1];
if (temp < tp)
{
int x = tp / temp;
int y = log2(x);
if (temp*pow(2,y) < tp)y++;
brr[i] += y;
}
else if (temp > tp)
{
int x = temp / tp;
int y = log2(x);
brr[i] = max(0, brr[i] - y);
}
tp = temp;
}
for (int i = 1; i < n; i++)sum += brr[i];
cout << sum;
}