#include<bits/stdc++.h>
using namespace std;
const int maxn=1e6+10;
bool p[maxn];
int prime[maxn],mu[maxn],cnt;
long long sum[maxn];
int main()
{
	int l,r;
	scanf("%d %d",&l,&r);
    mu[1]=1;
	for(int i=2;i<=r;i++){
		if(!p[i]){prime[++cnt]=i,mu[i]=-1;}
		for(int j=1;i*prime[j]<=r&&j<=cnt;j++){
			p[i*prime[j]]=1;
			if(i%prime[j]==0){mu[i*prime[j]]=0;break;}
			mu[i*prime[j]]=-mu[i];
		}
	}
	long long ans=0;
	for(int d=2;d<=r;d++){
		for(int k=1;k<=r/d;k++){
			int L=ceil((double)l/(k*d)),R=r/(k*d);
			ans+=(long long)(R-L+1)*(R-L+1)*mu[k];
		}
	}
    if(l==1)l++;
	for(int i=l;i<=r;i++){
		for(int j=i*2;j<=r;j+=i)ans-=2;
	}
	ans-=r-l+1;
	printf("%lld\n",ans);
	return 0;
}
// #pragma GCC target ("avx,avx2")
// #include <bits/extc++.h>
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp> // Common file
// #include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update

#define f first
#define s second

using namespace std;
// using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
// typedef tree<int, null_type, less_equal<int>, 
// rb_tree_tag, tree_order_statistics_node_update> oset;
//========================================================
const int N = 2e5+5, K = 21, M = 5e4+5, mod = 1e9+7, len = 30, inf = 0x3f3f3f3f;

ll l, r;

ll cnt(ll d)
{
    ll c = r / d - (l - 1) / d;
    return c;
}


void run_case()
{
    cin >> l >> r;
    ll a[r + 1];
    ll ans = 0;
    for(int i=r; i>1; i--)
    {
        a[i] = cnt(i) * (cnt(i) - 1);
        for(int j=i + i; j<=r; j += i)
            a[i] -= a[j];

    }

    for(int i=2; i<=r; i++)
    {
        if(i < l) continue;
        a[i] -= (cnt(i) - 1) * 2;
    }
    for(int i=2; i<=r; i++) ans += a[i];
    cout << ans << endl;
}

int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    // freopen("input.txt", "rt", stdin);
    // freopen("output.txt", "wt", stdout);
    int T = 1;
    // cin >> T;
    while(T--)
        run_case();
}


/*
    1000000000
*/