#include <bits/stdc++.h>
using namespace std;
int n, a[111111];
int isp2[222222];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
  }
  for (int i = 1, p = 1; i < 222222; i *= 2, ++p) {
    isp2[i] = p;
  }
  sort(a, a + n);
  int ans = 1e9;
  for (int dv = 0; a[n - 1] >= (1 << dv); ++dv) {
    for (int mul = 0; mul <= dv + 1; ++mul) {
      int val = a[n - 1];
      for (int i = 0; i < dv; ++i) {
        val /= 2;
      }
      for (int i = 0; i < mul; ++i) {
        val *= 2;
      }
      int tot = 0;
      for (int i = 0; i < n; ++i) {
        int cur = a[i];
        while (cur > 0 && !(val % cur == 0 && isp2[val / cur])) {
          cur /= 2;
          ++tot;
        }
        if (cur > 0) {
          tot += isp2[val / cur] - 1;
        } else {
          tot = 1e9;
          break;
        }
      }
      ans = min(ans, tot);
    }
  }
  cout << ans << endl;
}
