#include <bits/stdc++.h>
int main() {
  int n, a[100000], i, j, count = 0;
  scanf("%d", &n);
  if (1 <= n && n < 10000) {
    for (i = 0; i < n; i++) {
      scanf("%d", &a[i]);
      if (a[i] < 2 && 1000000 < a[i]) break;
    }
    for (i = 0; i < n; i++) {
      if (a[i] == 2)
        count++;
      else if (a[i] < 2 || a[i] % 2 == 0)
        continue;
      else {
        j = 3;
        while (j < a[i]) {
          if (a[i] % j == 0) break;
          j = j + 2;
        }
        count++;
      }
    }
  }
  printf("%d\n", count);
  return 0;
}
