#include <bits/stdc++.h>
using namespace std;
constexpr int INF = 1000000000;
constexpr int MODULO = 1000000007;
constexpr int evx[4] = {1, 0, -1, 0};
constexpr int evy[4] = {0, 1, 0, -1};
constexpr int Sup = 50000000;
bool number[Sup];
vector<int> primes;
void era() {
  for (int i = 0; i < Sup; ++i) {
    number[i] = true;
  }
  primes.push_back(2);
  primes.push_back(3);
  int prime = 1;
  while (true) {
    int add = 2 * prime + 1;
    for (int i = prime + add; i < Sup; i += add) {
      number[i] = false;
    }
    int j = prime + 1;
    while (true) {
      if (j >= Sup)
        return;
      else if (number[j]) {
        prime = j;
        primes.push_back(2 * prime + 1);
        break;
      }
      j++;
    }
  }
}
signed main() {
  ios::sync_with_stdio(false);
  era();
  int n;
  cin >> n;
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    int tmp;
    cin >> tmp;
    ans += binary_search(primes.begin(), primes.end(), tmp);
  }
  cout << ans << '\n';
}
