import math

r = 50000000
sqrt = int(math.sqrt(r))
p = [1 for i in range(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
n = int(raw_input())
for i in range(n):
    m = int(raw_input())
    if p[m-1]:
        count += 1
    except:
        break
print count