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