import math
n = int(raw_input())
ls = [int(raw_inpu() for i in range(n)]
r = max(ls)+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)]
   
ans = 0
for i in ls:
    ans += p[i-1]
print ans