mod = 1000000007 eps = 10**-9 def main(): import sys from math import sqrt input = sys.stdin.buffer.readline L, R = map(int, input().split()) N = 10 ** 6 cnt = [0] * (N + 1) for d in range(N, 1, -1): cnt[d] += R // (d**2) - (L - 1) // (d**2) for x in range(2, N+1): if d*x > N: break cnt[d] -= cnt[d*x] ans = R - (L - 1) - sum(cnt) for i in range(L, R+1): if i <= N**2: continue j = sqrt(i) for k in range(-2, 3): if j+k > 0: if (j+k) ** 2 == i: ans -= 1 print(ans) if __name__ == '__main__': main()