#include <bits/stdc++.h>
using namespace std;
const int maxN = (int)1E5 + 5;
int n;
int a[maxN], a_max;
int f[maxN], avail[maxN];
int result;
int main() {
  scanf("%d", &n);
  a_max = 0;
  for (int i = 0; i < n; ++i) scanf("%d", &a[i]), a_max = max(a_max, a[i]);
  memset(f, 0, sizeof(f));
  memset(avail, 0, sizeof(avail));
  for (int i = 0; i < n; ++i) {
    ++avail[a[i]];
    for (int t = a[i], l = 0; t * 2 <= a_max;) f[t *= 2] += ++l, ++avail[t];
    for (int t = a[i], l = 0; t / 2 >= 1;) {
      int tmp = t;
      f[t /= 2] += ++l;
      ++avail[t];
      if (2 * t < tmp)
        for (int tt = t, ll = l; tt * 2 <= a_max;)
          f[tt *= 2] += ++ll, ++avail[tt];
    }
  }
  result = (int)1E9;
  for (int i = 1; i <= a_max; ++i)
    if (avail[i] == n) result = min(result, f[i]);
  printf("%d\n", result);
  return 0;
}
