#include <bits/stdc++.h>
int main() {
  int n, A[10000];
  int i, j, ct = 0;
  int flag = 0;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &A[i]);
  }
  for (i = 0; i < n; i++) {
    flag = 0;
    if (A[i] == 2) {
      ct++;
      continue;
    } else
      for (j = 2; j < A[i]; j += 3) {
        if (A[i] % j == 0) {
          flag = 1;
          break;
        }
      }
    if (flag == 0) ct++;
  }
  printf("%d\n", ct);
  return 0;
}
