#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int prime[1000001] = {0};
  int N, inp, cnt = 0;
  prime[0] = 1, prime[1] = 1;
  for (int i = 0; i < 1000001; i++) {
    if (prime[i] == 0) {
      for (int j = i * 2; j < 1000001; j += i) {
        prime[j] = 1;
      }
    }
  }
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> inp;
    if (prime[inp] == 0) cnt++;
  }
  cout << cnt << endl;
  return 0;
}
