#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x = 0;
  int a[10000], b[10000] = {0};
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 2; i <= n; i++) {
    if (b[i - 1] == 0) {
      for (int j = i * 2; j <= n; j += i) {
        if (b[j - 1] == 0) b[j - 1] = 1;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    if (b[a[i] - 1] == 0) x++;
  }
  cout << x << endl;
  return 0;
}
