#include <bits/stdc++.h>
using namespace std;
int power(int x, int n, int MOD) {
  int res = 1;
  while (n > 0) {
    if (n & 1) res = res * x % MOD;
    x = x * x % MOD;
    n >>= 1;
  }
  return res;
}
bool suspect(int a, int s, int d, int n) {
  int x = power(a, d, n);
  if (x == 1) return true;
  for (int i = 0; i < s; i++) {
    if (x == n - 1) return true;
    x = x * x % n;
  }
  return false;
}
bool isPrime(int n) {
  if (n == 1 || (n > 2 && n % 2 == 0)) return false;
  int d = n - 1, s = 0, tmp[] = {2, 3, 5, 7, 11, 13, 17, 19, 23};
  while (d % 2 == 0) ++s, d /= 2;
  for (int i = 0; tmp[i] < n && i < 9; i++) {
    if (!suspect(tmp[i], s, d, n)) return false;
  }
  return true;
}
int main() {
  int q, n, ret = 0;
  scanf("%d", &q);
  while (q--) {
    scanf("%d", &n);
    ret += isPrime(n);
  }
  printf("%d\n", ret);
}
