#include <bits/stdc++.h>
int main() {
  int n, temp, ans = 0;
  bool prime[1000001], f;
  for (int i = 0; i < 1000001; i++) prime[i] = true;
  for (int i = 4; i < 1000001; i += 2) prime[i] = false;
  for (int i = 3; i < 1001; i += 2) {
    if (prime[i]) {
      for (int j = i * i; j < 1000001; j += i) prime[j] = false;
    }
  }
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &temp);
    if (temp > 1000000) {
      f = true;
      for (int j = 3; j * j < temp && f; j += 2)
        if (temp % j == 0) f = false;
      if (f) ans++;
    } else if (prime[temp])
      ans++;
  }
  printf("%d\n", ans);
}
