#エラトステネスの篩 m=2*10**6 prime=[] d=[-1]*(m+1) for i in range(2,m+1): if d[i]==-1: d[i]=i prime.append(i) j=2 while i*j<=m: d[i*j]=i j+=1 l,r=map(int,input().split()) ans=0 for i in prime: if i==2: if l<=i<=2: ans+=1 continue if l<=i<=r: ans+=1 if l<=(i-1)//2<=r: ans+=1 print(ans)