#include <bits/stdc++.h>
int main() {
  int n;
  bool if_p[10000];
  for (int i = 0; i < 10000; i++) if_p[i] = true;
  if_p[0] = false;
  if_p[1] = true;
  for (int lim = 1; lim < 10000; lim = lim * (lim + 2)) {
    for (int iter = 0; iter <= lim; iter++) {
      if (if_p[iter])
        for (int i = 2; i * (iter + 1) <= 10000; i++)
          if_p[i * (iter + 1) - 1] = false;
    }
  }
  std::cin >> n;
  int count = 0;
  for (; n--;) {
    int input;
    std::cin >> input;
    if (if_p[input - 1]) count++;
  }
  std::cout << count << std::endl;
  return 0;
}
