#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>

uint64_t get_size(uint64_t n) {
  return n % 6 % 5 == 0 ? (n - 1) / 3 : (n / 6) * 2;
}

std::vector<int> generate_primes(uint64_t upperbound) {
  uint64_t sieve_size = get_size(upperbound);
  std::vector<bool> sieve(sieve_size, true);
  uint64_t limit = get_size(sqrt(upperbound));

  for(uint64_t i = 0; i != limit; ++i) {
    int p = i * 3 - (i & 1) + 5;
    uint64_t j;
    for(j = p * 2; j < sieve_size - i; j += p * 2) {
      sieve.at(j + i) = false;
      sieve.at(j - i - 3) = false;
    }

    if(j < sieve_size + i + 3) {
      sieve.at(j - i - 3) = false;
    }
  }

  std::vector<int> ret;
  ret.push_back(2);
  ret.push_back(3);

  for(uint64_t i = 0; i < sieve_size; ++i) {
    if(sieve.at(i))
      ret.push_back(i * 3 - (i & 1) + 5);
  }

  return ret;
}

int main(void) {
  int n;
  std::cin >> n;

  int x;
  std::vector<int> xs;
  for(int i = 0; i < n; ++i) {
    std::cin >> x;
    xs.push_back(x);
  }

  std::sort(xs.begin(), xs.end());
  auto primes = generate_primes(xs.back());

  int count =
    std::count_if(xs.begin(), xs.end(), [&](auto x) { return std::binary_search(primes.begin(), primes.end(), x); });

  std::cout << count << std::endl;

  return 0;
}