import java.io.*; import java.util.*; class Main { public static void main(String args[])throws Exception { BufferedReader bu=new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb=new StringBuilder(); String s[]=bu.readLine().split(" "); long a=Long.parseLong(s[0])-1,b=Long.parseLong(s[1]); int imax=maxpower(b,5),ima=maxpower(a,5); int d=maxpower(b/imax,2),d2=maxpower(a/ima,2); if(a==0) d2=0; int m[]=mobius(d); long s1=0,s2=0; int i; for(i=1;i<=d;i++) { s1+=m[i]*(b/(1l*i*i)); if(i<=d2) s2+=m[i]*(a/(1l*i*i)); } int mlist[]=new int[d+1]; for(i=1;i<=d;i++) mlist[i]=mlist[i-1]+m[i]; s1+=squarefree(b,imax,d,mlist); s2+=squarefree(a,ima,d2,mlist); sb.append(s1-s2+"\n"); System.out.print(sb); } static int maxpower(long n,int p) { if(n==0) return 1; int l=1,r=(int)1e9,m,ans,i; if(p==5) r=3190; ans=r; while(l<=r) { m=(l+r)>>1; long v=1; for(i=0;i mxi=new ArrayList<>(); int sum=0; int i; for(i=imax-1;i>0;i--) { int cur=1; int root=maxpower(n/i,2),sqd=maxpower(root,2),j; for(j=1;j<=root/(sqd+1);j++) cur-=(root/j-root/(j+1))*mlist[j]; for(j=2;j<=sqd;j++) if(root/j<=d) cur-=mlist[(root/j)]; else cur-=mxi.get((imax-j*j*i-1)); mxi.add(cur); sum+=cur; } return sum-(imax-1)*mlist[d]; } }