#include <bits/stdc++.h>
int main() {
  int n, num, i = 0, j, flag = 0, total = 0;
  scanf("%d", &n);
  if (n >= 1 && n <= 10000) {
    while (i < n) {
      scanf("%d", &num);
      if (num <= 2 && num >= 10E8) {
        exit(1);
      } else {
        for (j = 2; j < num; j++) {
          if (num % j == 0) {
            flag = 1;
            break;
          }
        }
        if (flag == 0) total++;
        flag = 0;
        i++;
      }
    }
    printf("%d\n", total);
  }
  return 0;
}
