import math def sqrt(n): ins = math.floor(math.sqrt(n)) if ins**2 > n: ins -= 1 return ins l,r = map(int,input().split()) v = [l+i for i in range(r-l+1)] w = [0 for i in range(r-l+1)] dp = [0 for i in range(10**6+1)] for i in range(2, 10**6): if dp[i] == 0: #A/(i**2) = integer for j in range((l+i**2-1)//(i**2), r//(i**2)+1): w[j*(i**2) - l] = 1 #A/i = square for j in range(max(2,sqrt(l//i)+1), sqrt(r//i)+1): #print(j**2 * i) w[i*(j**2) - l] = 1 for j in range(i, 10**6+1, i): dp[j] = 1 print(r-l+1 - sum(w))