#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, c = 0;
  cin >> n;
  for (int(i) = (0); (i) < (n); (i)++) {
    int r;
    cin >> r;
    if (r == 2 || r == 3) {
      c++;
      continue;
    }
    if (r > 1 && (r % 6 == 5 || r % 6 == 1)) {
      bool ch = true;
      for (int(j) = (2); (j) < ((int)sqrt(r)); (j)++) {
        if (r % j == 0) {
          ch = false;
          break;
        }
      }
      if (ch) c++;
    }
  }
  cout << c << endl;
  return 0;
}
