#include<bits/stdc++.h>
#define int long long
using namespace std;
inline int read(){
	int res=0;
	bool zf=0;
	char c;
	while(((c=getchar())<'0'||c>'9')&&c!='-');
	if(c=='-')zf=1;
	else res=c-'0';
	while((c=getchar())>='0'&&c<='9')res=(res<<3)+(res<<1)+c-'0';
	if(zf)return -res;
	return res;
}
int mu[1000005];
bool vis[1000005];
int prime[1000005],p;
inline int f(int a,int b,int d=1){
	if(!a||!b){
		return 0;
	}
	int n=a/d,m=b/d,t=min(n,m),ans=0;
	for(register int l=1,r;l<=t;l=r+1){
		r=min(t,min(n/(n/l),m/(m/l)));
		ans+=(n/l)*(m/l)*(mu[r]-mu[l-1]);
	}
	return ans;
}
signed main(){
	vis[1]=1;mu[1]=1;
	for(register int i=2;i<=1000000;i++){
		if(!vis[i]){prime[++p]=i;vis[i]=1;mu[i]=-1;}
		for(register int j=1;j<=p;j++){
			if(prime[j]*i>1000000)break;
			vis[prime[j]*i]=1;
			mu[prime[j]*i]=(i%prime[j]?-mu[i]:0);
			if(!(i%prime[j]))break;
		}
		mu[i]+=mu[i-1];
	}
	int l=read(),r=read(),A=0;
	for(register int i=2;i<=r;++i){
		int a=l/i-3;
		while(a==1||a*i<l){
			++a;
		}
		int b=r/i+3;
		while(b*i>r){
			--b;
		}
		A+=f(b,b)-f(a-1,b)-f(b,a-1)+f(a-1,a-1);
	}
	printf("%lld\n",A);
	return 0;
}
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back               
#define mp make_pair         
#define nline "\n"
const ll M1=1e9+7;                                               
const ll M2=998244353;                           
const ll N=1000005; 
const ll INF_MUL=1e13;                                                      
const ll INF_ADD=1e18;   
#define f first                             
#define s second                                
#define pll pair<ll,ll>       
#ifndef ONLINE_JUDGE    
#define debug(x) cerr<<#x<<" "; _print(x); cerr<<nline;
#else
#define debug(x);  
#endif     
void _print(ll x){cerr<<x;}    
template<class T,class V> void _print(pair<T,V> p) {cerr<<"{"; _print(p.first);cerr<<","; _print(p.second);cerr<<"}";}
template<class T>void _print(vector<T> v) {cerr<<" [ "; for (T i:v){_print(i);cerr<<" ";}cerr<<"]";}
template<class T>void _print(set<T> v) {cerr<<" [ "; for (T i:v){_print(i); cerr<<" ";}cerr<<"]";}
template<class T>void _print(multiset<T> v) {cerr<< " [ "; for (T i:v){_print(i);cerr<<" ";}cerr<<"]";}
template<class T,class V>void _print(map<T, V> v) {cerr<<" [ "; for(auto i:v) {_print(i);cerr<<" ";} cerr<<"]";} 
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

void solve(){
    ll l,r,final=0; cin>>l>>r;  
    vector<ll> ans(r+5,0),bad(r+5,0);           
    for(ll i=r-1;i>=2;i--){   
        ans[i]=r/i-(l-1)/i-(i>=l);
        bad[i]=r/i-(l-1)/i;
        bad[i]=bad[i]*(bad[i]-1);   
        ans[i]=ans[i]*(ans[i]-1);   
        for(ll j=i+i;j<=r;j+=i){   
            ans[i]-=bad[j];
            bad[i]-=bad[j];
        }   
        final+=ans[i];
    }    
    cout<<final;
    return;
}                  
int main()                                                     
{                  
    ios_base::sync_with_stdio(false);                        
    cin.tie(NULL);                       
    #ifndef ONLINE_JUDGE            
    freopen("input.txt", "r", stdin);                                           
    freopen("output.txt", "w", stdout);  
    freopen("error.txt", "w", stderr);                        
    #endif    
    ll test_cases=1;              
    //cin>>test_cases;
    while(test_cases--){  
        solve();   
    }
    /*
    Correct data type?
    Infinity?
    Base case?
    */
    cerr<<"Time:"<<1000*((double)clock())/(double)CLOCKS_PER_SEC<<"ms\n"; 
} 