#include <bits/stdc++.h>
using namespace std;
long long n, m;
long long A[200306], pr[200306];
long long dp[200306];
void solve() {
  cin >> n;
  for (long long i = (1), iend = (n); i <= iend; ++i) {
    scanf("%lld", A + i);
    while (A[i] % 2 == 0) A[i] /= 2, ++pr[i];
  }
  long long re = n + 1;
  for (long long i = (1), iend = (n); i <= iend; ++i) {
    dp[i] = i - 1;
    for (long long j = (1), jend = (i - 1); j <= jend; ++j) {
      if (A[j] % A[i] == 0 && (pr[i] < i - j || pr[i] - pr[j] == i - j))
        dp[i] = min(dp[i], dp[j] + (i - j - 1));
    }
    re = min(re, dp[i] + n - i);
  }
  cout << re << endl;
}
signed main() { solve(); }
