#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const long long linf = 1e18;
const int inf = 1e9;
const int N = 1e5 + 5;
int n, m, dp[N];
long long a[N], cnt[N];
bool cool(long long x, long long y, long long l) {
  long long t1 = a[x], t2 = a[y];
  t2 = max(t2 / (1ll << l), cnt[y]);
  if ((t2 % 2 && t1 % t2 == 0) || (t2 % 2 == 0 && 2 * t1 % t2 == 0 && t1 % t2))
    return true;
  return false;
}
int f(int x) {
  if (x >= n) return 0;
  int &r = dp[x];
  if (r != -1) return r;
  r = n - x;
  for (int i = x + 1; i <= n; i++)
    if (cool(x, i, i - x - 1)) r = min(r, f(i) + i - x - 1);
  return r;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
  for (int i = 1; i <= n; i++) {
    long long x = a[i], s = 0;
    while (x % 2 == 0) {
      s++;
      x /= 2;
    }
    cnt[i] = x;
  }
  memset(dp, -1, sizeof dp);
  int ans = inf;
  for (int i = 1; i <= n; i++) ans = min(ans, f(i) + i - 1);
  cout << ans << '\n';
  return 0;
}
