#include <bits/stdc++.h>
using namespace std;
const int N = 200010;
const int mod = 1000000007;
long long a[N], b[N], c[N];
int dp[N];
int main() {
  int n, q;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%I64d", &a[i]);
    long long x = a[i];
    while (x % 2 == 0) b[i]++, x /= 2;
    c[i] = x;
  }
  dp[0] = 0;
  for (int i = 1; i <= n; i++) dp[i] = 100000;
  for (int i = 1; i <= n; i++) {
    dp[i] = min(dp[i], (dp[0] + (i - 1)));
    for (int j = 1; j < i - 1; j++) {
      if ((b[i] == 0 || (b[i] - b[j]) == i - j || b[i] <= i - j - 1) &&
          (c[j] % c[i] == 0)) {
        dp[i] = min(dp[i], dp[j] + (i - j - 1));
      }
    }
    if ((b[i] == 0 || (b[i] - b[i - 1]) == 1) && (c[i - 1] % c[i] == 0)) {
      dp[i] = min(dp[i], dp[i - 1]);
    }
  }
  int ans = 1000000;
  for (int i = 1; i <= n; i++) {
    ans = min(ans, dp[i] + (n - i));
  }
  printf("%d\n", ans);
  return 0;
}
