#include <bits/stdc++.h>
char prime[5000012];
int main(void) {
  memset(prime, 0x1, sizeof(prime));
  prime[0] = 0;
  for (long long int i = 3; i < 100000020; i += 2)
    if (prime[i / 2])
      for (long long int j = 3; i * j < 100000020; j += 2) prime[i * j / 2] = 0;
  int n;
  scanf("%d", &n);
  int res = 0;
  for (int i = 0; i < n; i++) {
    int a;
    scanf("%d", &a);
    if (!(a % 2) && a - 2) continue;
    if (prime[a / 2]) res++;
  }
  printf("%d\n", res);
  return 0;
}
