#include <bits/stdc++.h>
using namespace std;
bool is_prime(int n) {
  if ((int)pow(2, n - 1) % n == 1 || n == 2)
    return true;
  else
    return false;
}
int main() {
  int n, tmp, cnt = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> tmp;
    if (is_prime(tmp)) cnt++;
  }
  cout << cnt << endl;
  return 0;
}
