#include <bits/stdc++.h>
using namespace std;
long long n, a[10100], p[10100], f[10100];
bool Check(int x, int y) {
  if (a[x] % a[y]) return 0;
  return p[y] - p[x] == y - x || p[y] < y - x;
}
int main(void) {
  scanf("%lld", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    while (!(a[i] & 1)) {
      a[i] >>= 1;
      p[i]++;
    }
  }
  f[1] = 0;
  for (int i = 2; 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);
  }
  long long ans = n - 1;
  for (int i = 2; i <= n; i++) ans = min(ans, n + f[i] - i);
  printf("%lld\n", ans);
  return 0;
}
