#include <bits/stdc++.h>

#define fo(i, x, y) for (int i = (x); i <= (y); ++i)
#define fd(i, x, y) for (int i = (x); i >= (y); --i)
using namespace std;

typedef long long ll;

const int maxn = 1e6 + 5, lim = 1e6;

int l, r, tot;
int pri[maxn], v[maxn], cnt[maxn];
vector<int> fac[maxn], s[maxn];

int getint()
{
	char ch;
	int res = 0, p;
	while (!isdigit(ch = getchar()) && ch != '-');
	p = ch == '-'? ch = getchar(), -1 : 1;
	while (isdigit(ch))
		res = res * 10 + ch - '0', ch = getchar();
	return res * p;
}

int cal(int x)
{
	int sz = s[x].size(), allset = (1 << sz) - 1;
	int res = 0;
	fo(i, 1, allset)
	{
		int p = 1, ss = 0;
		fo(j, 0, sz - 1)
			if ((i >> j) & 1) p *= s[x][j], ss++;
		if (ss & 1) res += cnt[p];
		else res -= cnt[p];
	}
	return res;
}

void upd(int x)
{
	int sz = s[x].size(), allset = (1 << sz) - 1;
	fo(i, 1, allset)
	{
		int p = 1;
		fo(j, 0, sz - 1)
			if ((i >> j) & 1) p *= s[x][j];
		cnt[p]++;
	}
}

int main()
{
	//int st = clock();
	//freopen("t.in", "r", stdin);
	fo(i, 1, lim)
		fo(j, 1, lim / i)
			fac[i * j].push_back(i);
	fo(i, 2, lim)
	{
		if (!v[i]) v[i] = i, pri[++tot] = i;
		fo(j, 1, tot)
		{
			if (pri[j] > v[i] || pri[j] > lim / i) break;
			v[i * pri[j]] = pri[j];
		}
	}
	fo(i, 2, lim)
	{
		int x = i;
		while (x > 1)
		{
			int t = v[x];
			s[i].push_back(t);
			while (x > 1 && !(x % t)) x /= t;
		}
	}
	cin >> l >> r;
	if (l == 1) l++;
	ll ans = 0;
	fo(i, l, r)
	{
		upd(i);
		//cerr << cal(i) << " ";
		ans += cal(i);
		int cnt = fac[i].end() - lower_bound(fac[i].begin(), fac[i].end(), l);
		ans -= cnt;
		//cerr << cnt << " ";
	}
	//cerr << endl;
	ans <<= 1;
	cout << ans << endl;
	//cerr << clock() - st;
	return 0;
}
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
	cin.tie(nullptr)->sync_with_stdio(false);
	int l,r;
	cin >> l >> r;
	l = max(l,2LL);
	vector<int>dp(1000001);
	for(int i = 1000000; i>=1; i--){
		int nums = r/i - (l-1)/i;
		dp[i] = nums*nums;
		for(int j = 2*i; j<=1000000; j+=i){
			dp[i]-=dp[j];
		}
	}
	int ans = 0;
	for(int i = 2; i<=1000000; i++){
		ans+=dp[i];
	}
	ans-=r-l+1;
	for(int i = l; i<=r; i++){
		for(int j = 2*i; j<=r; j+=i){
			if(__gcd(i,j)!=1)
			ans-=2;
		}
	}
	cout << ans << "\n";
	return 0;
}