#include <bits/stdc++.h>
using namespace std;
const bool read_file = false;
const char fi[] = "XX.INP";
const char fo[] = "XX.OUT";
void set_up() {
  if (read_file) {
    freopen(fi, "r", stdin);
    freopen(fo, "w", stdout);
  }
  cin.clear();
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
void just_do_it();
int main() {
  set_up();
  just_do_it();
}
const int ms = 5e3 + 20;
int n;
long long a[ms];
int c[ms];
int f[ms];
int dp[ms];
bool check(int j, int i, int deg) {
  long long x = a[j];
  long long y = a[i];
  int m = c[j];
  int n = c[i];
  if (x % y == 0) {
    if (n - m == deg || deg - 1 >= n) {
      return true;
    } else {
      return false;
    }
  } else {
    return false;
  }
}
void just_do_it() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    while (a[i] % 2 == 0) {
      a[i] /= 2;
      c[i]++;
    }
  }
  fill_n(dp, ms, ms);
  dp[0] = 0;
  for (int i = 1; i < n; i++) {
    dp[i] = min(dp[i], i);
    for (int j = 0; j < i; j++) {
      if (check(j, i, i - j)) {
        dp[i] = min(dp[i], dp[j] + i - j - 1);
      }
    }
  }
  int res = ms;
  for (int i = 0; i < n; i++) {
    res = min(res, dp[i] + n - i - 1);
  }
  cout << res;
}
