#include <bits/stdc++.h>
int main() {
  int i, j, n, s, ary[10000], y;
  bool a[10000000];
  double x;
  for (i = 0; i < 10000000; i++) {
    a[i] = i >= 2 ? 1 : 0;
  }
  x = sqrt((double)10000000);
  y = (int)x;
  for (i = 1; i < y; i++) {
    if (a[i]) {
      for (j = 0; i * (j + 2) < 10000000; j++) {
        a[i * (j + 2)] = 0;
      }
    }
  }
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &ary[i]);
  }
  s = 0;
  for (i = 0; i < n; i++) {
    if (a[ary[i]]) s++;
  }
  printf("%d\n", s);
}
