#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, s[i].push_back(i), pri[++tot] = i;
		fo(j, 1, tot)
		{
			if (pri[j] > v[i] || pri[j] > lim / i) break;
			v[i * pri[j]] = pri[j];
			s[i * pri[j]] = s[i];
			if (pri[j] != v[i]) s[i * pri[j]].push_back(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);
		ans += cal(i);
		int cnt = fac[i].end() - lower_bound(fac[i].begin(), fac[i].end(), l);
		ans -= cnt;
	}
	ans <<= 1;
	cout << ans << endl;
	return 0;
}
#include <iostream>
#include <vector>
#include <cmath>
#include <ostream>
#include <list>
#include <map>
#include <algorithm>
#include <climits>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <bitset>
#include <cstring>
#include <deque>
#include <set>
#include <stack>
#include <queue>
#include <chrono>
#include <deque>
#include <string>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#define ll long long
#define mod 1000000007
#define cbit __builtin_popcountll
#define pl pair<long, long>
#define pqp priority_queue<pl>
#define mkp make_pair
#define vl vector<ll>
#define vvl vector<vl >
#define pb push_back
#define inf 10000000
#define all(v) v.begin(), v.end()

long long gcd(long long int a, long long int b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
long long lcm(ll a, ll b)
{
    return (a / gcd(a, b)) * b;
}


ll mod_power(ll a,ll b)
{
    if(b==0)
    {
        return 1;
    }
    ll temp=mod_power(a,b/2);
    temp%=mod;
    temp*=temp;
    temp%=mod;
    if(b%2==1)
    {
        temp*=a;
        temp%=mod;
    }
    return temp;
}
struct compare {
    bool operator()(const pair<ll,ll > &a,const pair<ll,ll > &b)
    {
        return a.first>b.first;
    }
};

bool comp(const pair<ll,ll > &a,const pair<ll,ll > &b)
{
    if(a.first==b.first)
    {
        return a.second<b.second;
    }
    return a.first<b.first;
}
vl mb(1e6+5,0);
ll calmb(ll n,vl& div)
{
    ll cnt=0;
    while(n>1)
    {
        ll k=0;
        ll d=div[n];
        while(n%d==0)
        {
            n/=d;
            k++;
            if(k>1)
            {
                return 0;
            }
        }
        cnt++;
    }
    if(cnt%2)
    {
        return -1;
    }
    return 1;
}
void seive()
{
    mb[1]=0;
    vl div(1e6+5,0);
    for(ll i=2;i<1e6+5;i++)
    {
        if(div[i]==0)
        {
            for(ll j=i;j<1e6+5;j+=i)
            {
                if(div[j]==0)
                {
                    div[j]=i;
                }
            }
        }
        mb[i]=calmb(i,div);
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    ll t = 1;
    // cin >> t;
    seive();
    while (t--)
    {
        ll l,r;
        cin>>l>>r;
        if(l==1)
        {
            l++;
        }
        ll ans=0;
        for(ll i=1;i<=r;i++)
        {
            ll cnt=r/i-(l-1)/i;
            ans-=mb[i]*cnt*cnt;
        }
        for(ll i=l;i<=r;i++){
            for(ll j=i;j<=r;j+=i)
            {
                ans--;
			    if(i != j) ans--;
            }
        }
        cout<<ans<<"\n";
    }
    return 0;
}