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>).
from math import sqrt


def sieve(n):
    primes = [True] * n
    primes[0] = primes[1] = False
    for i in range(2, int(sqrt(n))):
        if primes[i]:
            for j in range(i * i, n, i):
                primes[j] = False
    return [index for index, item in enumerate(primes) if item]


def segmented_sieve(n):
    result = 0
    limit = int(sqrt(n)) + 1
    primes = sieve(limit)
    for prime in primes:
        if prime % 4 == 1 or prime == 2:
            result += 1
    low = limit
    high = limit * 2
    while low < n:
        if high >= n:
            high = n
        mark = [True] * (limit + 1)
        for prime in primes:
            lo_lim = int(low / prime) * prime
            if lo_lim < low:
                lo_lim += prime
            for j in range(lo_lim, high, prime):
                mark[j - low] = False
        for i in range(low, high):
            if mark[i - low]:
                if i % 4 == 1 or i == 2:
                    result += 1
        low = low + limit
        high = high + limit
    return result


_input = input().split(' ')
a = int(_input[0])
b = int(_input[1])
print(segmented_sieve(b + 1) - segmented_sieve(a))
