#include <bits/stdc++.h>
int main() {
  int i, j, n, s, ary[10000], most = 0;
  bool a[10000000];
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &ary[i]);
    if (ary[i] > most) most = ary[i];
  }
  for (i = 0; i < most + 1; i++) {
    a[i] = i >= 2 ? 1 : 0;
  }
  for (i = 2; i < sqrt(most); i++) {
    if (a[i]) {
      for (j = 0; i * (j + 2) < 10000000; j++) {
        a[i * (j + 2)] = 0;
      }
    }
  }
  s = 0;
  for (i = 0; i < n; i++) {
    if (a[ary[i]]) s++;
  }
  printf("%d\n", s);
}
