#include <bits/stdc++.h>
int prime_check(long num) {
  int i, n;
  long max;
  if (num % 2 == 0) {
    max = num / 2;
  } else {
    max = num / 2 + 1;
  }
  n = 0;
  for (i = 1; i <= max; i++) {
    if (num % i == 0) n++;
    if (i != (num - i)) {
      if (num % (num + 1 - i) == 0) n++;
    }
  }
  if (num == 2) n = 2;
  if (n == 2) return 1;
  return 0;
}
int main(void) {
  int i, n, boo, count;
  long num;
  scanf("%d", &n);
  count = 0;
  for (i = 0; i < n; i++) {
    scanf("%ld", &num);
    if (num % 2 == 0 || num % 3 == 0 || num % 5 == 0 || num % 7 == 0) continue;
    boo = prime_check(num);
    if (boo == 1) count++;
  }
  printf("%d\n", count);
  return 0;
}
