import sys read=sys.stdin.buffer.read readline=sys.stdin.buffer.readline readlines=sys.stdin.buffer.readlines import math def prime_sieve(n): isprime=[True]*(n+1) isprime[0]=False isprime[1]=False for i in range(2, n+1): if isprime[i]: for j in range(2*i, n+1, i): isprime[j]=False return isprime isprime=prime_sieve(1000000) l, r=map(int, readline().split()) v=list(range(l, r+1)) sqf=[True]*(r-l+1) for p in range(2, 1000000): if not isprime[p]: continue for i in range((l+p-1)//p*p, r+1, p): if not sqf[i-l]: continue v[i-l]//=p if v[i-l]%p==0: sqf[i-l]=False ans=0 for i in range(r-l+1): if not sqf[i]: continue if v[i]==1: ans+=1 continue sq=int(math.sqrt(v[i])) ans+=1 for j in range(sq, sq+2): if j*j==v[i]: ans-=1 break print(ans)