#include <bits/stdc++.h>
#define pii pair<int,int>
#define fi first
#define pb push_back
#define si second
#define int long long
// #define ll long long 
#define mod 1000000007
// #define mod 998244353
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define double long double
#define all(o) o.begin(),o.end()
using namespace std;


// int mod;
int power(int x, int y)
{
    int res = 1LL;
    x = x % mod;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % mod;
        y = y>>1; // y = y/2
        x = (x*x) % mod;
    }
    return res%mod;
}
int inv(int  n)
{
    return power(n,mod-2)%mod;
}

int isprime(int n){
    if(n<2)return 0;
    int i;
    for(i=2;i*i<=n;i++)
        if(n%i==0)
            return 0;
    return 1;

}
int sq(int n){
    return n*n;
}


const int N=2e5+10;


vector<int> a[1000005];
int p[1000005];
void solve(){

    int mx=0;
    int i,j,k;
    int l,r;
    cin>>l>>r;

    if(l==1)
        l++;

    if(l>r)
    {   cout<<"0\n";
        return;
    }
    

    for(i=2;i<=1e6;i++)
    {   for(j=2*i;j<=1e6;j+=i)
        {   a[j].pb(i);
            mx=max(mx,(int)a[j].size());
        }
        p[i]=i;
        if(a[i].size())
            p[i]=a[i][0];

    }

    int cnt=0,coprime=0;
    for(i=l;i<=r;i++)
    {
        if(a[i].size()){
            int lo=0,hi=a[i].size();
            while(lo<hi){
                int mid=(lo+hi)/2;
                if(a[i][mid]>=l)
                    hi=mid;
                else lo=mid+1;
            }
            int val=a[i].size()-lo;
            cnt+=val;
        }

        vector<int> pf;

        int cur=i;
        while(cur>1){
            int cp=p[cur];
            pf.pb(cp);
            while(cur%cp==0)
                cur/=cp;
        } 
        int sz=pf.size();

        int total=0;
        for(j=1;j<(1<<sz);j++)
        {
            int prod=1;
            int bc=__builtin_popcount(j);
            int coprime_cnt=0;
            for(k=0;k<sz;k++)
                if(j&(1<<k))
                    prod*=pf[k];

            coprime_cnt=i/prod-(l-1)/prod;

            if(bc%2==0)
                coprime_cnt*=-1;
            total+=coprime_cnt;
        }
        coprime+=i-l+1-total;
    }
    cnt+=coprime;
    cnt*=2;

    int len=r-l+1;

    cnt+=len;
    cout<<len*len-cnt<<"\n";






    




}
int32_t main(){
   fast
    int t=1;
    int tc=0;
    // cin>>t; 


    while(t--) 
    {
        tc++;
        // cout<<"Case #"<<tc<<": "
        solve();
    }
}
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define vec vector
using namespace std;

const int MX = 1e6 + 1;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	#ifdef LOCAL
//		freopen("in1.txt", "r", stdin);
//		freopen("in1.txt", "w", stdout);
	#endif
	int l, r;
	cin >> l >> r;
	vec<int> lpf(MX);
	for (int i=2; i<MX; i++) {
		if (lpf[i] > 0) continue;
		for (int j=i; j<MX; j+=i) lpf[j] = i;
	}
	ll res = 0;
	for (int i=2; i<=r; i++) {
		int x = i, prm = 0;
		bool poss = 1;
		while (x > 1) {
			int y = lpf[x], cnt = 0;
			while (x%y == 0) {
				x /= y;
				cnt++;
			}
			if (cnt > 1) {
				poss = 0;
				break;
			}
			prm++;
		}
		if (poss) {
			ll c = r/i - (l-1)/i;
			if (prm&1) res += c*(c-1) / 2;
			else res -= c*(c-1) / 2;
		}
	}
//	cout << 2*res << '\n';
	for (int i=max(2, l); i<=r; i++) res -= r/i-1;
	cout << 2*res << '\n';
}