#include <bits/stdc++.h>
using namespace std;
const int maxn = 5005;
int f[maxn], n;
long long a[maxn], p[maxn], q[maxn];
inline bool check(int x, int y) {
  if (q[x] % q[y]) return 0;
  return p[y] - p[x] == y - x || p[y] <= y - x - 1;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    while (!(a[i] & 1)) {
      p[i]++;
      a[i] >>= 1;
    }
    q[i] = a[i];
  }
  for (int i = 1; i <= n; i++) {
    f[i] = i - 1;
    for (int j = 1; j < i; j++)
      if (check(j, i)) f[i] = min(f[i], f[j] + i - j - 1);
  }
  int ans = 0x3f3f3f3f;
  for (int i = 1; i <= n; i++) ans = min(ans, f[i] + n - i);
  printf("%d\n", ans);
}
