#include <bits/stdc++.h>
using namespace std;
int next(int n) { return n == 2 ? 3 : n + 2; }
int square(int n) { return n * n; }
bool isEven(int n) { return n % 2 == 0 ? true : false; }
int fastExpt(int base, int exp) {
  if (exp == 0)
    return 1;
  else if (isEven(exp))
    return square(base) * fastExpt(base, exp - 2);
  else
    return base * fastExpt(base, exp - 1);
}
int expmod(int base, int exp, int m) {
  if (square(base) % exp == 1 && base != 1 && base != (exp - 1))
    return 0;
  else
    return fastExpt(base, exp) % m;
}
bool felmatTestIter(int n, int a) {
  if (a == n)
    return true;
  else if (expmod(a, n, n) == a % n)
    return felmatTestIter(n, next(a));
  else
    return false;
}
bool felmatTest(int n) { return felmatTestIter(n, 2); }
int main() {
  int N, n, count = 0;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> n;
    if (felmatTest(n)) count++;
  }
  cout << count << endl;
  return 0;
}
