#include <bits/stdc++.h>
int main() {
  int n;
  int s;
  int counter = 0, i, j;
  scanf("%d", &n);
  if (n < 1 || n > 10000) {
    return 0;
  }
  for (i = n; i > 0; i--) {
    scanf("%d", &s);
    if (s < 2 || s > 10e8) {
      return 0;
    }
    for (j = 3; j < s; j += 2) {
      if (s % j == 0) break;
    }
    if (j == s || s == 2) counter++;
  }
  printf("%d\n", counter);
  return 0;
}
