#include<bits/stdc++.h>
using namespace std;

#define int long long

signed main(){
	int l,r;
	cin>>l>>r;
	
	if(l==r){
		cout<<0;return 0;
	}
	
	if(l==1)l++;
	
	if(r-l==1){
		cout<<1;return 0;
	}
	
	vector<int> d(r+1,0);
	
	for(int i=2;i<=r;i++){
		if(d[i]!=0)continue;
		for(int j=i;j<=r;j+=i){
			d[j]++;
		}
		for(int j=i*i;j<=r;j+=i*i){
			d[j]=-10000000;
		}
	}
	
	int ncop=0;
	
	for(int i=2;i<=r;i++){
		if(d[i]<0)continue;
		int x=r/i-(l-1)/i;
		//cout<<i<<' '<<x<<' '<<d[i]<<' ';
		x=x*(x-1)/2;
		ncop+=(d[i]%2)?x:-x;
		//cout<<ncop<<'\n';
	}
	
	int div=0;
	
	for(int i=l;i<=r;i++){
		div+=r/i-1;
	}
	
	cout<<(ncop-div)*2;
	return 0;
}
#include<algorithm>
#include<iostream>
#include<cstring>
#include<bitset>
#include<cstdio>
#include<string>
#include<cmath>
#include<queue>
#include<stack>
#include<map>
#include<set>
using namespace std;
#define neinf 0xc0c0c0c0c0c0c0c0ll
#define inf 0x3f3f3f3f3f3f3f3fll
#define uint unsigned int
#define ull unsigned ll
#define HgS 1000000007
#define pr pair<ll,ll>
#define prpr make_pair
#define ll long long
#define opr operator
#define reg register
#define gc getchar
#define pc putchar
#define ret return
#define cst const
#define db double
#define il inline
il ll rd()
{
	reg ll res=0,lab=1;
	reg char ch=gc();
	while((ch<'0'||ch>'9')&&ch!=EOF){if(ch=='-')lab=-lab;ch=gc();}
	while(ch>='0'&&ch<='9')res=(res<<3)+(res<<1)+(ch&15),ch=gc();
	ret res*lab;
}
il void prt(ll x,char t='\n')
{
	static char ch[70];int tp=0;
	if(!x){fputs("0",stdout);if(t)pc(t);ret;}
	if(x<0)pc('-'),x=-x;
	while(x)ch[++tp]=(x%10)^48,x/=10;
	while(tp)pc(ch[tp--]);
	if(t)pc(t);
}
il ll umax(ll a,ll b){return a>b?a:b;}
il ll umin(ll a,ll b){return a<b?a:b;}
il ll uabs(ll x){return x>0?x:-x;}
il ll qpow(ll n,ll e=HgS-2,ll p=HgS)
{
	n%=p;reg ll res=1;
	while(e){if(e&1)res=res*n%p;n=n*n%p;e>>=1;}
	ret res;
}
ll l,r,mu[1000005],sum[1000005];bool vis[1000005];
ll slv(int x,int y)
{
	ll ans=0;
	for(int l=1,r;l<=umin(x,y);l=r+1)
	{
		r=umin(x/(x/l),y/(y/l));
		ans+=1ll*(x/l)*(y/l)*(sum[r]-sum[l-1]);
	}
	return ans;
}
int main()
{
	l=rd(),r=rd();
	for(int i=1;i<=r;++i)mu[i]=1;
	for(int i=2;i<=r;++i)
	{
		if(vis[i])continue;
		for(int j=i;j<=r;j+=i)
		{
			vis[j]=1;
			if(1ll*j%(1ll*i*i)==0)mu[j]=0;
			else mu[j]=-mu[j];
		}
	}
	for(int i=1;i<=r;++i)sum[i]=sum[i-1]+mu[i];
	ll s1=0,s2=slv(r,r)-slv(l-1,r)-slv(r,l-1)+slv(l-1,l-1);
	for(int i=umax(l,2);i<=r;++i){++s1;for(int j=2;j*i<=r;++j)s1+=2;}
	prt(1ll*(r-l+1)*(r-l+1)-s1-s2);
	ret 0;
}