#include <bits/stdc++.h>
using namespace std;
int dp[6000];
pair<long long, int> a[5111];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i].first;
  for (int i = 1; i <= n; i++) {
    while (a[i].first % 2 == 0) {
      a[i].second++;
      a[i].first /= 2;
    }
  }
  dp[1] = 0;
  for (int i = 2; i <= n; i++) {
    dp[i] = i - 1;
    for (int j = 1; j < i; j++) {
      if (a[j].first % a[i].first == 0)
        if (((a[i].second - a[j].second <= i - j) &&
             ((a[j].second - j == a[i].second - i) || a[j].second == 0)) ||
            (a[i].second == 0) || (a[i].second <= i - j - 1)) {
          dp[i] = min(dp[j] + (i - j - 1), dp[i]);
        }
    }
  }
  int ans = 100000;
  for (int i = 1; i <= n; i++) {
    ans = min(ans, dp[i] + n - i);
  }
  cout << ans;
  return 0;
}
