#include <bits/stdc++.h>
int keisan(int);
int main() {
  int i, j, num;
  int S[10000];
  int count = 0;
  while (1) {
    scanf("%d", &num);
    if (num >= 1 && num <= 10000) break;
  }
  for (i = 0; i < num; i++) {
    scanf("%d", &S[i]);
  }
  for (i = 0; i < num; i++) {
    if (keisan(S[i]) == 1) count++;
  }
  printf("%d\n", count);
  return 0;
}
int keisan(int a) {
  int i;
  if (a == 2) return 1;
  if (a < 2 || a % 2 == 0) return 0;
  i = 3;
  while (i <= a / 2 + 1) {
    if (a % i == 0) return 0;
    i = i + 2;
  }
  return 1;
}
