def primes(n): is_prime = [True] * (n + 1) is_prime[0] = False is_prime[1] = False for i in range(2, int(n**0.5) + 1): if not is_prime[i]: continue for j in range(i * 2, n + 1, i): is_prime[j] = False return [i for i in range(n + 1) if is_prime[i]] l, r = map(int, input().split()) k = list(range(l, r + 1)) d = [1] * (r - l + 1) pr = primes(1000000) for p in pr: x = 1 while x * p <= r: x *= p for i in range(l + x - 1 - (l + x - 1) % x, r + 1, x): k[i - l] //= p t = p * p for i in range(l + t - 1 - (l + t - 1) % t, r + 1, t): d[i - l] = 0 ans = r - l + 1 for i in range(r - l + 1): if d[i] == 0 or (k[i] > 1 and int((k[i]+1)**.5)**2==k[i]): ans -= 1 print(ans)