n=gets.chomp.to_i
ary=Array.new(n)
k=0
j=3
for i in 0..n-1
	ary[i]=gets.chomp.to_i
	root=Math.sqrt(ary[i]).to_i
			if ary[i]==2 || ary[i]==3 || ary[i]==5 || ary[i]==7
				k += 1
				print(k,"?´???°1\n")
			elsif ary[i]<2 || ary[i]%2==0
#				puts "?´???°??§?????????1"
			else
				while j <= root
#					print(j,"j??????\n")
					if ary[i]%j==0
						break # puts "?´???°??§?????????2"
					elsif j==root &&  ary[i]%j!=0
						k += 1
						break  print("j=",j," k=",k," ?´???°2\n")
					else
						k += 1
						break  print("j=",j," k=",k," ?´???°2\n")

					end
					j+=2
				end
			end
end
puts k