from math import sqrt
from itertools import takewhile
n = int(input())
e = [int(input()) for _ in range(n)]
L, pnum, tmp = sqrt(e[-1]+1), [], [i for i in range(2, e[-1]+1)]
while tmp[0] < L:
    v = tmp.pop(0)
    pnum.append(v)
    tmp = list(filter(lambda x: x%v!=0, tmp))
for t in tmp: pnum.append(t)
print(len(list(takewhile(lambda x: x<=e[-1], pnum)))-len(list(takewhile(lambda x: x<e[0], pnum))))