5
1 8 1 7 9
 4
6 7 4 5
 5
36 37 6 18 36
 3
5 1 3
 200
2 1 1 1 2 1 2 1 1 1 2 1 2 2 2 1 1 2 1 2 1 1 1 2 2 1 2 1 1 2 1 1 1 2 1 1 2 2 2 2 2 2 2 2 2 2 1 2 2 1 2 1 2 2 1 1 2 2 2 2 2 2 2 1 1 1 2 1 2 2 1 1 2 1 2 2 2 1 2 1 1 1 2 1 1 2 2 1 2 2 1 2 2 1 1 2 1 1 1 1 1 2 2 1 1 2 1 2 2 2 1 2 1 1 1 2 2 1 2 2 2 1 1 2 1 2 2 1 2 2 2 1 1 2 2 1 2 1 1 2 2 1 2 1 2 1 2 2 2 1 1 2 2 1 1 2 1 1 1 2 2 2 1 2 2 2 1 2 1 1 1 1 2 1 2 1 2 1 1 1 2 2 2 1 2 1 1 2 2 1 1 1 1 1 2 2 2 1 2 2
 10
104105246720 52052623360 213207545282560 426415090565120 6354080 832841973760 26650943160320 6506577920 50832640 832841973760
 3
9 4 4
 10
3 3 3 3 3 3 3 3 3 3
 100
24 33 88 55 4 24 19 19 63 90 9 47 24 74 21 43 20 100 58 15 36 66 13 4 9 51 24 96 50 27 100 41 92 9 67 94 17 11 98 24 72 57 96 85 50 9 45 41 63 76 80 59 25 67 21 84 88 15 62 60 79 65 5 66 1 85 92 100 61 75 44 96 53 97 2 28 83 42 60 42 34 73 44 99 58 46 75 100 75 55 35 52 93 80 69 75 50 67 100 77
 200
1 2 1 2 2 1 2 2 2 1 1 1 2 2 1 2 2 1 2 1 1 2 1 2 1 2 2 1 2 2 1 2 1 2 1 2 1 2 2 1 1 1 1 2 1 1 2 2 1 2 1 1 2 2 2 1 2 1 1 1 1 1 1 1 2 1 2 2 2 2 2 2 1 1 1 2 2 2 2 2 1 2 1 2 1 2 2 2 1 1 1 1 2 1 1 1 2 2 1 2 1 1 1 2 2 1 1 2 1 2 1 2 1 1 1 2 2 2 1 1 1 2 2 2 1 2 1 2 2 1 2 2 2 1 1 1 1 1 2 2 2 2 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
import static java.lang.Math.min;

public class D {
	static int n;
	static long[] a, s;
	static int[] p2;

	static boolean can(int i, int j) {
		if (s[i] % s[j] != 0) {
			return false;
		}
		if (p2[j] == 0) {
			// odd
			return 1 + p2[i] + (j - i - 1) > p2[j];
		} else {
			// even
			if (j == i + 1) {
				return 1 + p2[i] == p2[j];
			} else {
				return 1 + p2[i] + (j - i - 1) == p2[j] || 1 + (j - i - 2) >= p2[j];
			}
		}
	}

	static void solve() {
		n = nextInt();
		a = new long[n];
		p2 = new int[n];
		s = new long[n];
		for (int i = 0; i < n; i++) {
			a[i] = nextLong();
			p2[i] = Long.numberOfTrailingZeros(a[i]);
			s[i] = a[i] >> p2[i];
		}
		int[] d = new int[n]; // longest chain
		d[0] = 1;
		for (int i = 1; i < n; i++) {
			d[i] = 1;
			for (int j = 0; j < i; j++) {
				if (can(j, i) && d[i] < d[j] + 1) {
					d[i] = d[j] + 1;
				}
			}
		}
		int ans = n;
		for (int i = 0; i < n; i++) {
			ans = min(ans, n - d[i]);
		}
		writer.println(ans);
	}

	public static void main(String[] args) throws Exception {
		reader = new BufferedReader(new InputStreamReader(System.in));
		writer = new PrintWriter(System.out);
		Locale.setDefault(Locale.US);

		setTime();
		solve();
		printTime();
		printMemory();

		writer.close();
	}

	static BufferedReader reader;
	static PrintWriter writer;
	static StringTokenizer tok = new StringTokenizer("");
	static long systemTime;

	static void debug(Object... o) {
		System.err.println(deepToString(o));
	}

	static void setTime() {
		systemTime = System.currentTimeMillis();
	}

	static void printTime() {
		System.err.println("Time consumed: " + (System.currentTimeMillis() - systemTime));
	}

	static void printMemory() {
		System.err.println("Memory consumed: "
				+ (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / 1000 + "kb");
	}

	static String next() {
		while (!tok.hasMoreTokens()) {
			String w = null;
			try {
				w = reader.readLine();
			} catch (Exception e) {
				e.printStackTrace();
			}
			if (w == null)
				return null;
			tok = new StringTokenizer(w);
		}
		return tok.nextToken();
	}

	static int nextInt() {
		return Integer.parseInt(next());
	}

	static long nextLong() {
		return Long.parseLong(next());
	}

	static double nextDouble() {
		return Double.parseDouble(next());
	}

	static BigInteger nextBigInteger() {
		return new BigInteger(next());
	}
}