#include <bits/stdc++.h>
using namespace std;
const int N = 2e6 + 1;
const int INF = 1e9 + 9;
const int B = 1e9 + 7;
int n, b[N], d[N];
long long a[N];
int main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  int ans = n;
  for (int i = int(1); i <= int(n); ++i) {
    cin >> a[i];
    while (a[i] % 2 == 0) a[i] /= 2, ++b[i];
    d[i] = i - 1;
    for (int j = int(1); j <= int(i - 1); ++j)
      if (a[j] % a[i] == 0 &&
          (b[j] + (i - j) == b[i] || b[i] <= i - j - 1 || b[i] == 0))
        d[i] = min(d[i], d[j] + (i - j - 1));
    ans = min(ans, d[i] + (n - i));
  }
  cout << ans << "\n";
  return 0;
}
