#include <bits/stdc++.h>
int main() {
  int n, i, j, x, s = 0;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &x);
    for (j = 2; j < n; j++) {
      if (x % j == 0) break;
      if (x - 1 == n) s = s + 1;
    }
  }
  printf("%d\n", s);
  return 0;
}
