#include <bits/stdc++.h>
bool prime[10000000 + 1];
int main() {
  int n, count = 0;
  int i, j;
  std::cin >> n;
  for (i = 0; i <= 10000000; i++) {
    prime[i] = true;
  }
  prime[0] = false;
  prime[1] = false;
  for (i = 2; i * i <= 10000000; i++) {
    if (prime[i]) {
      for (int j = 2; i * (j + 2) < 10000000; ++j) prime[i * (j + 2)] = false;
    }
  }
  for (int i = 0; i < n; i++) {
    int x;
    std::cin >> x;
    if (prime[x]) {
      count++;
    }
  }
  std::cout << count << std::endl;
}
