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