#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, num = 0;
  cin >> n;
  vector<int> a(10000000 + 1, 1);
  for (int i = 2; i * i < 10000000 + 1; i++) {
    if (a[i] == 1) {
      for (int j = 2; j * i < 10000000 + 1; j++) {
        a[j * i] = 0;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    if (a[x] == 1) num++;
  }
  cout << num << endl;
  return 0;
}
