#include <stdio.h>
#include <stdlib.h>
#include <math.h>



int main(){
  //const int data_num = 100;
  //int data[data_num] = {5, 6, 8};

  int n = 10000;
  int flag[n + 1];
  int ans = 0;
  int i, j;
  for (i = 1; i < n + 1; i++)
    flag[i] = 1;
  flag[1] = 0;

  for (i = 1; i < sqrt(n + 1); i++){
    if (flag[i] == 1)
      for (j = 2; i * j < n +1; j++)
        flag[i * j] = 0;
  }

//  for (i = 1; i < 100; i++)
//    printf("%d, %d\n", i, flag[i]);

  // データ読み込み
  //for (i = 0; i < data_num; i++)
  int data;
  while(fgets(line, sizeof(line), stdin) != NULL) {
    if (sscanf(line, "%d", &data) != 1) {
      fputs("sscanf: Convert error\n", stderr);
      return EXIT_FAILURE;
    }
    if (flag[data[i]] == 1)
      ans++;
  }
  printf("%d\n", ans);

  return 0;
}

