#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  while (cin >> n) {
    int input[10000] = {0};
    int max = 0;
    for (int i = 0; i < n; i++) {
      cin >> input[i];
      if (max < input[i]) max = input[i];
    }
    bool *sosuu = new bool[60000000];
    for (int i = 0; i <= max; i++) sosuu[i] = 1;
    sosuu[0] = 0;
    for (int i = 2; i <= max; i++) {
      if (i % 2 != 0) {
        int now = i;
        if (sosuu[i / 2] == 1) {
          while (now <= max) {
            now += i * 2;
            sosuu[now / 2] = 0;
          }
        }
      }
    }
    int sum = 0;
    int temp = 1;
    for (int i = 0; i < n; i++) {
      if (input[i] == 2) {
        sum += temp;
        temp = 0;
      } else if (input[i] % 2 != 0) {
        sum += sosuu[input[i] / 2];
        sosuu[input[i] / 2] = 0;
      }
    }
    cout << sum << endl;
  }
}
