#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int a[10000];
  int sw = 0;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int j = 2; j < n; j++) {
    if (a[j] % j == 0) break;
    sw++;
  }
  cout << sw << endl;
  return 0;
}
