#include <bits/stdc++.h>
using namespace std;
const int maxn = 10001;
int n;
long long f[maxn], b[maxn], a[maxn];
inline long long max(long long a, long long b) { return a > b ? a : b; }
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%I64d", &a[i]);
    while (a[i] % 2 == 0) {
      a[i] /= 2;
      b[i]++;
    }
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= i - 1; j++)
      if (a[j] % a[i] == 0 && (b[j] + i - j == b[i] || b[i] <= i - j - 1))
        f[i] = max(f[i], f[j]);
    f[i]++;
    ans = max(ans, f[i]);
  }
  cout << n - ans << endl;
  fclose(stdin);
}
