import sys input = lambda :sys.stdin.readline()[:-1] ni = lambda :int(input()) na = lambda :list(map(int,input().split())) sys.setrecursionlimit(10**7) yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES") no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO") ####################################################################### import math def pi(n): if n<=1: return 0 m = int(math.sqrt(n)) keys = [n // i for i in range(1, m + 1)] keys += range(keys[-1] - 1, 0, -1) h = {i : i - 1 for i in keys} for i in range(2, m + 1): if h[i] > h[i - 1]: hp = h[i - 1] i2 = i * i for j in keys: if j < i2: break h[j] -= h[j // i] - hp return h[n] L,R = na() print(pi(R)-pi(L-1)+pi(2*R-1)-pi(2*L))