#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  cin.ignore();
  vector<int> v;
  for (int i = 0; i < n; i++) {
    int t;
    cin >> t;
    v.push_back(t);
  }
  int m = *max_element(v.begin(), v.end()) + 1;
  bool* bp;
  bp = (bool*)malloc(sizeof(bool) * m);
  memset(bp, true, sizeof(bool) * m);
  bp[0] = false;
  bp[1] = false;
  for (int i = 2; i * i < m; i++) {
    if (*(bp + sizeof(bool) * i) == true) {
      for (int j = i * i; j < m; j += i) {
        *(bp + sizeof(bool) * j) = false;
      }
    }
  }
  int count = 0;
  for (int i = 0; i < v.size(); i++) {
    if (*(bp + v[i]) == true) count++;
  }
  cout << count << endl;
  return 0;
}
