#include <bits/stdc++.h>
using namespace std;
struct cww {
  cww() {
    ios::sync_with_stdio(false);
    cin.tie(0);
  }
} star;
vector<int> ret{2};
inline void ps(int n = 1e8) {
  vector<bool> ok(n, true);
  ret.reserve(n + 1);
  for (int i = 3; i < n; i += 2) {
    if (!ok[i / 2]) continue;
    ret.emplace_back(i);
    for (int j = i / 2 + i, n2 = n / 2; j < n2; j += i) ok[j] = false;
  }
}
int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = (0), i_len = (n); i < i_len; ++i) cin >> v[i];
  sort((v).begin(), (v).end());
  ps();
  int cnt = 0;
  int j = 0;
  for (int i = (0), i_len = (n); i < i_len; ++i) {
    if (v[i] > ret[j]) ++j;
    if (v[i] == ret[j]) ++cnt;
  }
  cout << (cnt) << endl;
  return 0;
}
