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]),b=Long.parseLong(s[1]); sb.append(squarefree(b)-squarefree(a-1)+"\n"); System.out.print(sb); } static int[] mobius(int n) { boolean p[]=new boolean[n+1]; int i,j,mob[]=new int[n+1]; Arrays.fill(mob,1); for(i=2;i<=n;i++) if(!p[i]) { mob[i]=-1; for(j=2;j<=n/i;j++) { p[i*j]=true; mob[i*j]*=-1; } long sq=1l*i*i; for(j=1;j<=n/sq;j++) mob[j*i*i]=0; } return mob; } //https://smsxgz.github.io/post/pe/counting_square_free_numbers/ static long squarefree(long n) { if(n<3) return n; int imax=maxpower(n,5); int d=maxpower(n/imax,2); int m[]=mobius(d); long s1=0; int i; for(i=1;i<=d;i++) s1+=m[i]*(n/(1l*i*i)); long mlist[]=new long[d+1]; for(i=1;i<=d;i++) mlist[i]=mlist[i-1]+m[i]; ArrayList mxi=new ArrayList<>(); int sum=0; for(i=imax-1;i>0;i--) { long 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 s1+sum-(imax-1)*mlist[d]; } static int maxpower(long n,int p) { 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