#include <bits/stdc++.h>
using namespace std;
long long a[100010], b[100010], c[100010];
int f[100010];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%I64d", &a[i]);
  for (int i = 1; i <= n; i++) {
    long long temp = a[i];
    while (temp % 2 == 0) temp /= 2, b[i]++;
    c[i] = temp;
  }
  f[1] = 0;
  for (int i = 2; i <= n; i++) {
    f[i] = i - 1;
    for (int j = 1; j < i; j++)
      if (c[j] % c[i] == 0)
        if (b[i] == b[j] + i - j || b[i] <= i - j - 1)
          f[i] = min(f[i], f[j] + i - j - 1);
  }
  int ans = n - 1;
  for (int i = 1; i <= n; i++) ans = min(ans, f[i] + n - i);
  cout << ans << endl;
  return 0;
}
