import math

n = int(raw_input())
a = []
for i in range(n):
    a.append(int(raw_input()))

r = max(a)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
    if p[i]:
        p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)]

count = 0
for i in a:
    count += p[i-1]
    
print count