from math import sqrt
def isprime(farm, prime):
	first = min(farm)
	maxfarm = max(farm)
	while len(farm) > 0 and sqrt(maxfarm) > first:
		first = min(farm)
		prime.append(first)
		maxfarm = max(farm)
		dellst = range(first, maxfarm+1, first)
		farm = set(farm - set(dellst))
	return prime.extend(farm)
 
n = int(input())
inlst = []
for i in range(n):
    inlst.append(int(input()))
farm = set(range(3, max(inlst)+1, 2))
prime = [1,2]
 
if len(farm) > 0:
    isprime(farm, prime)
     
out = list(set(inlst) & set(prime))
print(len(out))