#include <bits/stdc++.h>
using namespace std;
bool prime[100000000];
void build_table();
void check();
int main() {
  build_table();
  int n;
  cin >> n;
  int cnt = 0;
  int in;
  for (int i = 0; i < n; i++) {
    cin >> in;
    if (prime[in] == true) cnt++;
  }
  cout << cnt << endl;
}
void build_table() {
  for (int i = 0; i < 100000000; i++) prime[i] = true;
  int sqrt_num = sqrt(100000000);
  prime[0] = prime[1] = false;
  for (int i = 2; i <= sqrt_num; i++) {
    if (prime[i]) {
      for (int k = (100000000 - 1) / i, j = k * i; k >= i; k--, j -= i) {
        if (prime[k]) prime[j] = false;
      }
    }
  }
}
void check() {
  for (int i = 0; i < 100; i++)
    if (prime[i]) cout << i << endl;
}
