#mempi=dict() mempi={1:0,2:1,3:2,4:2,5:3,6:3,7:4,8:4,9:4,10:4,11:5} memP2=dict() memPHI=dict() P=[] M=10000000 F=[0]*M for i in range(2,M): if F[i]: continue P.append(i) for j in range(i*2,M,i): F[j]=1 X=[0]*M X[1]=0 Z=75000 Y=[[0]*400 for i in range(Z)] for m in range(Z): for n in range(400): if m==0: continue if n==0: Y[m][n]=m continue Y[m][n]=Y[m][n-1]-Y[m//P[n-1]][n-1] for t in range(len(P)-1): for i in range(P[t],P[t+1]): X[i]=t+1 def P2(m,n,y): if memP2.get((m,n,y),-1)>=0: return memP2[(m,n,y)] i=0 x=0 while im: break if y=0: return x x=PHI(m,n-1)-PHI(m//P[n-1],n-1) #memPHI[(m,n)]=x return x s=set() def pi(m): if m<1: return 0 if m=0: # return mempi[m] x=int(m**(1/3)) n=0 y=0 for i in range(x-3,x+3): if i*i*i>=m: y=i n=pi(y) break x=PHI(m,n)+n-1-P2(m,n,y) mempi[m]=x return x L,R=map(int,input().split()) if L==R: print(pi(R)-pi(R-1)) exit() print(pi(R)-pi(L-1)+pi(2*R-1)-pi(2*L))