#include <bits/stdc++.h>
bool s[50000000] = {false};
int main() {
  int k = 0, d, n;
  s[0] = true;
  for (int i = 3; i < 50000000; i += 2) {
    if (!s[(i - 1) / 2]) {
      k++;
      for (int j = i; i * j <= 50000000 * 2; j += 2) s[(i * j - 1) / 2] = true;
    }
  }
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &d);
    if (d % 2 == 1 || d != 2)
      if (!s[(d - 1) / 2]) k++;
  }
  printf("%d\n", k);
  return 0;
}
