while True:
try:
a=input()
b=(a.split())
p=0
n=0
for i in range(int(b[0]), int(b[1])+1): #或許是因為這裡沒有用sqrt()
n+=1
for j in range(2, i//2+1):
if i%j==0:
p+=1
break
print(n-p)
except:
break