import sys readline=sys.stdin.readline def Primes_Count(N): if N<2: return 0 v=int(N**0.5)+1 smalls=[i//2 for i in range(1,v+1)] smalls[1]=0 s=v//2 roughs=[2*i+1 for i in range(s)] larges=[(N//(2*i+1)+1)//2 for i in range(s)] skip=[False]*v pc=0 for p in range(3,v): if smalls[p]<=smalls[p-1]: continue q=p*p pc+=1 if q*q>N: break skip[p]=True for i in range(q,v,2*p): skip[i]=True ns=0 for k in range(s): i=roughs[k] if skip[i]: continue d=i*p larges[ns]=larges[k]-(larges[smalls[d]-pc] if dm: break s-=smalls[m//p]-(pc+l-1) larges[0]-=s return larges[0] L,R=map(int,readline().split()) ans=Primes_Count(R)-Primes_Count(L-1)+Primes_Count(2*R-1)-Primes_Count(2*L) if R==1: ans+=1 print(ans)