#include <bits/stdc++.h>
int main(void) {
  long i, j, end1, end2;
  long n, d, c;
  char *num;
  num = (char *)calloc((50000000), sizeof(char));
  end1 = (long)sqrt((double)(50000000));
  for (i = 3; i < end1; i += 2) {
    if (!num[(i - 3) >> 1]) {
      end2 = (50000000) / i;
      for (j = 3; j < end2; j += 2) {
        num[(i * j - 3) >> 1] = 1;
      }
    }
  }
  scanf("%ld", &n);
  c = 0;
  while (n-- > 0) {
    scanf("%ld", &d);
    if (d & 1) {
      if (!num[(d - 3) >> 1]) {
        c++;
      }
    } else {
      if (d == 2) {
        c++;
      }
    }
  }
  printf("%d\n", c);
  free(num);
  return 0;
}
