require 'prime'

$primes_u10000 = Prime.each(10000).to_a

def prime?(n)
	return n == $primes_u10000.bsearch{|x| n <= x} if n <= 10000

	# trial division
	limit = Math.sqrt(n).floor
	$primes_u10000.each do |d|
		break if limit < d
		return false if n % d == 0
	end

	return true
end

count = 0

gets.to_i.times do
	count += 1 if prime? gets.to_i
end

p count