#include <bits/stdc++.h>
int main() {
  int n, i, j, a;
  int flag, c = 0;
  double s;
  scanf("%d", &n);
  if (n < 10000) {
    for (i = 0; i < n; i++) {
      scanf("%d", &a);
      if (a < 2) {
        continue;
      }
      if (a == 2) {
        c++;
        continue;
      } else if (a % 2 == 0)
        continue;
      flag = 0;
      s = sqrt(a);
      for (j = 3; j < s; j += 2) {
        if (a % j == 0) {
          flag = 1;
          break;
        }
      }
      if (flag == 0) c++;
    }
    printf("%d", c);
  }
  return 0;
}
