#include <bits/stdc++.h>
using namespace std;
int dp[6000];
long long A[6000];
int stepA[6000];
long long stepOdd[6000];
int isPossible(int start, int end) {
  if (A[start] % 2 == 1 && (A[end] % A[start] == 0)) return 1;
  if (A[start] % 2 == 0) {
    long long a = A[start];
    int required = end - start;
    if (required <= stepA[start]) {
      a = (a >> required);
      if ((A[end] % a) == 0 && ((A[end] / a) % 2) == 1) {
        return 1;
      }
      return 0;
    }
    if ((A[end] % stepOdd[start]) == 0) return 1;
  }
  return 0;
}
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> A[i];
  }
  reverse(A + 1, A + n + 1);
  for (int i = 1; i <= n; i++) {
    long long a = A[i];
    while (a % 2 == 0) {
      stepA[i]++;
      a /= 2;
    }
    stepOdd[i] = a;
  }
  dp[1] = 0;
  for (int i = 2; i <= n; i++) {
    dp[i] = i - 1;
  }
  for (int i = 2; i <= n; i++) {
    for (int j = 1; j <= i - 1; j++) {
      if (isPossible(j, i)) {
        dp[i] = min(dp[i], dp[j] + (i - j - 1));
      }
    }
  }
  int ret = 10000;
  for (int i = 1; i <= n; i++) {
    ret = min(ret, dp[i] + (n - i));
  }
  cout << ret << endl;
  return 0;
}
