<?php

$n = trim(fgets(STDIN));

for ($i = 0; $i < $n; $i++) {
    $numbers[] = fgets(STDIN);
}

$count = 0;

for ($i = 0; $i < $n; $i++) {
    $num = (double) $numbers[$i];

    if ($num == 2) {
        $count += 1;
    } elseif ( $num < 2 or ($num % 2) == 0) {
    } else {
        $start = 3;
        while ($start <= sqrt($num) + 1) {
            if ($num % $start == 0) {
                break;
            }
            $start += 2;
        }
        $count += 1;
    }
}

echo $count . PHP_EOL;

