#include <bits/stdc++.h>
using namespace std;
int eratos[100000000];
void Eratos() {
  eratos[0] = 1;
  for (int i = 1; i * i <= 100000000; i++) {
    if (eratos[i - 1] == 0) {
      for (int j = i * 2; j <= 100000000; j += i) {
        eratos[j] = 1;
      }
    }
  }
}
int main() {
  int n, res;
  Eratos();
  cin >> n;
  for (int i = 0, tmp; i < n; i++) {
    cin >> tmp;
    if (eratos[tmp - 1] == 0) res++;
  }
  cout << res << endl;
  return 0;
}
