#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, n, cnt;
  bool pm[100000001];
  fill(pm, pm + 100000001, true);
  pm[0] = pm[1] = false;
  for (int i = 2; i < 100000001; ++i)
    if (pm[i])
      for (int j = i * 2; j < 100000001; j += i) pm[j] = false;
  while (cin >> n && n) {
    cnt = 0;
    while (n-- && cin >> t)
      if (pm[t]) ++cnt;
    cout << cnt << endl;
  }
  return 0;
}
