On the math lesson a teacher asked each pupil to come up with his own lucky numbers. As a fan of number theory Peter chose prime numbers. Bob was more original. He said that number *t* is his lucky number, if it can be represented as: 

Now, the boys decided to find out how many days of the interval [*l*, *r*] (*l* ≤ *r*) are suitable for pair programming. They decided that the day *i* (*l* ≤ *i* ≤ *r*) is suitable for pair programming if and only if the number *i* is lucky for Peter and lucky for Bob at the same time. Help the boys to find the number of such days.
The first line of the input contains integer numbers *l*, *r* (1 ≤ *l*, *r* ≤ 3·10<sup class="upper-index">8</sup>).
l, r = [int(x) for x in input().split()]

primes = []
lucky = [False for i in range(r + 1)]
composite = [False for i in range(r + 1)]

for i in range(2, r + 1):
    if not composite[i]:
        primes.append(i)
    for p in primes:
        if i * p > r: break
        composite[i * p] = True
        if i % p == 0: break

for i in range(int((r / 2.0) ** 0.5 + 0.5)):
    j = 1
    while i * i + j * j <= r:
        lucky[i * i + j * j] = True
        j += 1
print(sum([1 if lucky[i] and not composite[i] else 0 for i in range(l, r + 1)]))
   			 		  			  	  		 	 	   	