
#素数列を得る(10^8未満)

list = [2]
for j in 3..10**8
list.each{|q|
if q*q > j then
list.push(j)
break
end
if (j % q) == 0 then
break
end
}
end

n = gets.to_i
count = 0

n.times{

if list.include?(gets.to_i) == true
count += 1
end

}

puts count

