#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll>PII;
const int N = 2e5 + 10;
const int MOD = 998244353;
const int INF = 0X3F3F3F3F;
const int dx[] = {-1, 1, 0, 0, -1, -1, +1, +1};
const int dy[] = {0, 0, -1, 1, -1, +1, -1, +1};
const int M = 1e6 + 10;
ll a[N];
int main() {
int n;
cin >> n;
priority_queue<ll>q;
for (int i = 1; i <= n; i ++) {
cin >> a[i];
q.push(a[i]);
}
sort(a + 1, a + 1 + n);
int cnt = 0;
ll mins = a[1], maxs = a[n];//保证最大的跟最小的相同即可
if (mins == maxs) cout << 0 << endl;
else {
while (1) {
ll k = q.top();
q.pop();
if (k == mins) break;
else {
cnt ++;
k /= 2;
if (k < mins) mins = k;
q.push(k);
}
}
cout << cnt << endl;
}
return 0;
}