def eratosthenes(s, n):
is_prime = [True] * (n + 1)
for i in range(2, int(n ** 0.5) + 1):
if is_prime[i]:
for j in range(i * i, n + 1, i):
is_prime[j] = False
array = []
for x in range(s, n + 1):
if is_prime[x]:
array.append(x)
return array
array = eratosthenes(2, 100)
while True:
try:
t = list( map( int, input().split() ) )
if t[1] > array[-1]:
array = eratosthenes( array[-1], t[1] )
s = 0
for i in range( t[0], t[1]+1):
if i in array:
s += 1
print(s)
except:
break