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