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