#include <bits/stdc++.h> 
using namespace std;

template <class T>
inline bool mnto(T& a, T b) {return a > b ? a = b, 1 : 0;}
template <class T>
inline bool mxto(T& a, T b) {return a < b ? a = b, 1: 0;}
#define REP(i, s, e) for (int i = s; i < e; i++)
#define RREP(i, s, e) for (int i = s; i >= e; i--)
typedef long long ll;
typedef long double ld;
#define MP make_pair
#define FI first
#define SE second
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;
#define MT make_tuple
typedef tuple<int, int, int> iii;
#define ALL(_a) _a.begin(), _a.end()
#define pb emplace_back
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ii> vii;

#ifdef DEBUG
#define debug(args...) _debug(args)
void _debug(const char* format, ...) {
		va_list args;
			va_start(args, format);
				vprintf(format, args);
					va_end(args);
}
#else
#define debug(args...)
#endif

#define INF 1000000005
#define LINF 1000000000000000005
#define MOD 1000000007
#define MAXN 1000005

int l, r;
bool isp[MAXN];
int sp[MAXN];
vi primes;
ll ans;

int main() {
	scanf("%d%d", &l, &r);
	REP (i, 2, MAXN) isp[i] = 1;
	for (int i = 2; (ll) i * i <= r; i++) {
		if (!isp[i]) continue;
		sp[i] = i;
		for (int j = i * i; j <= r; j += i) {
			if (isp[j]) sp[j] = i;
			isp[j] = 0;
		}
	}
	REP (i, 2, r + 1) {
		if (isp[i]) {
			sp[i] = i;
		   	primes.pb(i);
		}
	}
	REP (i, 2, r + 1) {
		int u = i;
		int cnt = 0;
		int prv = -1;
		bool pos = 1;
		while (u != 1) {
			cnt++;
			if (prv == sp[u]) {
				pos = 0;
			}
			prv = sp[u];
			u /= sp[u];
		}
		if (!pos) continue;
		int lo = (l - 1) / i, hi = r / i;
		ll len = hi - lo;
		//debug("%d: %lld\n", i, len);
		if (cnt % 2 == 1) {
			//debug(" +\n");
			ans += len * (len - 1);
		} else {
			//debug(" -\n");
			ans -= len * (len - 1);
		}
	}
	//debug("%d\n", ans);
	REP (i, max(l, 2), r + 1) {
		int lo = (l - 1) / i, hi = r / i;
		ll len = hi - lo;
		ans -= (len - 1) * 2;
		//debug("%d: %d\n", i, len);
	}
	printf("%lld\n", ans);
	return 0;
}

//   PIGMEISTER™   //

#include <bits/stdc++.h>
using namespace std;

#define int long long
#define ld long double
#define sidha(i,x,n) for(int i=(int)(x);i<(int)(n);++i)
#define ulta(i,x,n) for(int i=(int)(x);i>=(int)(n);--i)
#define sab(a) a.begin(),a.end()
#define bas(a) a.rbegin(),a.rend()
#define test int _;cin>>_;while(_--)
#define jaldi ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
//#define MAX 100005
#define PI (ld)3.141592653589793238
#define MOD LLONG_MAX
//#define MOD (ll)1000000007
//#define MOD (ll)998244353
#define N 1000001
 
int lpf[N], mobius[N], a[N], fre[N];
void least_prime_factor()
{
    for (int i = 2; i < N; i++)
        if (!lpf[i])
            for (int j = i; j < N; j += i)
                if (!lpf[j])
                    lpf[j] = i;
}
 
void Mobius()
{
    for (int i = 1; i < N; i++) {
        if (i == 1)
            mobius[i] = 1;
        else {
            if (lpf[i / lpf[i]] == lpf[i])
                mobius[i] = 0;
            else
                mobius[i] = (int)-1 * mobius[i / lpf[i]];
        }
    }
}
 
int gcd_pairs(int n)
{
    int maxi = 0;

    for (int i = 0; i < n; i++) {
        fre[a[i]]++;
        maxi = max(a[i], maxi);
    }
 
    least_prime_factor();
    Mobius();
 
    int ans = 0;
    for (int i = 1; i <= maxi; i++) {
        if (!mobius[i])
            continue;
 
        int temp = 0;
        for (int j = i; j <= maxi; j += i)
            temp += fre[j];
 
        ans += temp * (temp - 1ll) / 2ll * mobius[i];
    }
 
    return ans;
}

signed main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    jaldi;
    
    int l, r;
    cin >> l >> r;

    int n = r-l+1;
    int ans = 0;
    sidha (i, 0, n) {
        a[i] = i+l;
        if (i+l == 1) continue;
        int cnt = r/(i+l);
        ans += 2*(cnt-1);
    }

    ans += 2 * gcd_pairs(n);
    // ulta (i, r-l, 2) {
    //     ll mn = max(1ll, (l-1)/i);
    //     ll mx = r/i;
    //     // cout << i << ' ' << mx << ' ' << mn << '\n';
    //     ans += (mx-mn)*(mx-mn-1);
    // }
    cout << n*(n-1) - ans;
    
    return 0;
}
