<?php
	$n = trim(fgets(STDIN));
	$a = array();
	while ($n--) {
		$a[] = trim(fgets(STDIN));
	}
	echo sosu($a) . "\n";

	function sosu($a) {
		$cnt = 0;
		foreach ($a as $v) {
			if ($v == 2) {
				$cnt++;
				continu;
			}
			if ($v < 2 || $v % 2 == 0) {
				continue;
			}

			$flg = false;
			$p = ceil(sqrt($v));
			for ($i = 2; $i <= $p; $i++) {
				if ($v % $i == 0) {
					$flg = true;
					break;
				}
			}
			if (!$flg) $cnt++;
		}
		return $cnt;
	}