#include <bits/stdc++.h>
using namespace std;
const int N = 100003;
const int MOD = 1000000007;
int n;
long long a[N];
int dp[N];
int main() {
  while (scanf("%d", &n) == 1) {
    for (int i = n - 1; i >= 0; --i) {
      cin >> a[i];
    }
    for (int i = 0; i < n; ++i) {
      dp[i] = max(dp[i], 1);
      long long t = a[i];
      for (int j = i + 1; j < n; ++j) {
        if (t & 1) {
          if (a[j] % t == 0) dp[j] = max(dp[j], dp[i] + 1);
        } else {
          t /= 2;
          if (a[j] % t == 0 && (a[j] / t % 2 == 1))
            dp[j] = max(dp[j], dp[i] + 1);
        }
      }
    }
    int ans = 0;
    for (int i = 0; i < n; ++i) {
      ans = max(ans, dp[i]);
    }
    printf("%d\n", n - ans);
  }
}
