#include <bits/stdc++.h>
using ::std::uint16_t;
using ::std::uint32_t;
using ::std::uint8_t;
bool is_prime(uint32_t n) {
  if (n < 2) {
    return false;
  }
  if (n < 4) {
    return true;
  }
  uint32_t remain = n % 6;
  if (remain != 1 && remain != 5) {
    return false;
  }
  for (uint32_t i = 5; i * i <= n; i += 5) {
    if ((n % i == 0) || (n + 2 % i == 0)) {
      return false;
    }
  }
  return true;
}
int main(void) {
  int prime_counter = 0;
  int num_of_questions;
  uint32_t n;
  std::cin >> num_of_questions;
  for (int i = 0; i < num_of_questions; ++i) {
    std::cin >> n;
    if (is_prime(n)) {
      ++prime_counter;
    }
  }
  std::cout << prime_counter << std::endl;
  return 0;
}
