#include <bits/stdc++.h>
class CPrime {
 public:
  bool JudgePrime(int num);
};
bool CPrime::JudgePrime(int num) {
  if ((num < (int)2) || (num > (int)100000000)) {
    return false;
  } else if ((num != 2) && ((num % 2) == 0)) {
    return false;
  }
  for (int i = 3; i <= sqrt(num); i = i + 2) {
    if ((num % i) == 0) {
      return false;
    }
  }
  return true;
}
int main(void) {
  CPrime prime;
  int num;
  int numint;
  int countprime;
  scanf("%d%*c", &numint);
  if ((numint < (int)1) || (numint > (int)10000)) {
    return -1;
  }
  for (int i = 0; i < numint; i++) {
    scanf("%d%*c", &num);
    if (prime.JudgePrime(num) == true) {
      printf("%d\n\n", num);
      countprime++;
    }
  }
  printf("%d\n", countprime);
  return 0;
}
