import math
n=int(input())
a=[]
c=0.0
for i in range(n):
  a.append(input())
cnt=0
b=[int(i) for i in a]
for i in range(n):
    if b[i]==2:
      cnt+=1
    for j in range(2,b[i]):
      if b[i]%j==0:
        break
      if b[i]-j==1:
        cnt+=1
print(cnt)       
      
