#include <bits/stdc++.h>
using namespace std;
int n;
int p[10000], dp[10000];
long long a[10000];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    while (a[i] % 2 == 0) {
      a[i] /= 2;
      p[i]++;
    }
  }
  for (int i = 0; i < n; i++) {
    dp[i] = 1;
    for (int j = 0; j < i; j++) {
      if (a[j] % a[i] != 0) continue;
      if ((i - j <= p[i]) && ((i - j) != p[i] - p[j])) continue;
      dp[i] = max(dp[i], dp[j] + 1);
    }
  }
  cout << (n - *max_element(dp, dp + n)) << endl;
  return 0;
}
