def root(x): p=x l=[p] while r[p]!=p: p=r[p] l+=[p] for p in l: r[p]=l[-1] return r[x] def union(x,y): rx=root(x) ry=root(y) if rx==ry: return if rx>ry: rx,ry=ry,rx r[ry]=rx return L,R=map(int,input().split()) r=list(range(R+1)) g=0 for i in range(L,R+1): for j in range(i+i,R+1,i): a=i b=j if root(a)!=root(b): g+=0 union(a,b) for i in range(L,R): a=i b=i+1 if root(a)!=root(b): g+=1 union(a,b) print(g)