#ifdef LOCAL
    cout<<"\nTime Elapsed: " << 1.0*clock() / CLOCKS_PER_SEC << " sec\n";
#endif
#include "bits/stdc++.h"
 
using namespace std;
using namespace std::chrono;
 
#define ll long long
#define vll vector<ll> 
#define pii pair<ll,ll> 
#define un_mp unordered_map<ll,ll,modified_hash>
#define endl "\n"
#define pb push_back
#define all(a) a.begin(),a.end()
 
ll  mod=1000000007;
 
struct modified_hash {
  
    static uint64_t splitmix64(uint64_t x){
        x += 0x9e3779b97f4a7c15;
        x=(x^(x>>30))*0xbf58476d1ce4e5b9;
        x=(x^(x>>27))*0x94d049bb133111eb;
        return x^(x>>31);
    }
  
    ll operator()(uint64_t x) const{
        static const uint64_t random= steady_clock::now().time_since_epoch().count();
        return splitmix64(x + random);
    }
}; 
const ll N = 1000000;
ll lp[N+1];
vector<ll> pr;

void solve(){
    ll a,b,k,c,n,d,m,x,y,l,r;
	ll i,j;
    cin>>l>>r;
    ll fans=0;
    for(ll i=2LL;i<=r;i++){
        un_mp mp;
        ll fk=i;
        bool flag=true;
        while (fk>1){
            mp[lp[fk]]++;
            if(mp[lp[fk]]>1) flag=false;
            fk/=lp[fk];
        }
        
        ll cnt=mp.size();
        ll ans=r/i-((l-1)/i);
        if(flag&&cnt%2==0){
            fans-=(ans*(ans-1))/2;
        }
        else if(flag){
            // cout<<i2<<" "<<ans<<endl;
            fans+=(ans*(ans-1))/2;
        }
        
    }
    for(ll i=max(2LL,l);i<=r;i++) fans-=(r/i-1);
    cout<<fans*2<<endl;
    
    return;
}
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll a,b,c,n,tt,d,m,k,x,y;
    tt=1;
    // cin>>tt;
    for (ll i=2;i<=N;++i){
        if (lp[i]==0){
            lp[i]=i;
            pr.push_back(i);
        }
        for (ll j=0;j<(ll)pr.size()&&pr[j]<=lp[i]&&i*pr[j]<=N;++j){
            lp[i*pr[j]]=pr[j];
        }
    }
    while(tt--){
        solve();
    }
}
// E - Divide Both
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;

int main(){
	int L, R; cin>>L>>R;

	auto x = [&](int k){ return R/k - (L-1)/k; };

	ll ans = 0;
	vector<ll> F(R+1);
	for(int k=R; k>=2; --k){
		ll c = x(k);
		F[k] = c * c;
		for(int g=2*k; g<=R; g+=k) F[k] -= F[g];
		ans += F[k];
	}

	for(int g=max(2, L); g<=R; ++g) ans -= x(g)*2 - 1;
	cout<< ans <<endl;
}
