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