#include <bits/stdc++.h>
int main() {
  int n, i, k, a, b, in = 0, p;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &a);
    for (k = 2; k <= a; k++) {
      p = k - 1;
      if (a != 3 && a % 3 == 0) break;
      if (a != 5 && a % 5 == 0) break;
      if (a != 7 && a % 7 == 0) break;
      if ((a % k) == 0 && (a / k) != 1) {
        break;
      }
      if (k > a / 2) {
        in++;
        break;
      }
      if ((6 * p + 1) == a) {
        in++;
        break;
      }
      if ((6 * p - 1) == a) {
        in++;
        break;
      }
    }
  }
  printf("%d\n", in);
  return 0;
}
