#include<bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#define endl "\n"
#define pb push_back
#define ll long long
#define d1(x)  cerr << #x << "--> " << x << endl
#define d2(x,y)  cerr << #x << "--> " << x << " | " << #y << "--> " << y <<endl
#define d3(x,y,z)  cerr << #x << "--> " << x << " | " << #y << "--> " << y <<" | " << #z << "--> "<< z<< endl
#define d4(x,y,z,w)  cerr << #x << "--> " << x << " | " << #y << "--> " << y <<" | " << #z << "--> "<< z << " | "<< #w << "--> " << w <<endl
#define vpll vector<pair<ll,ll>>
#define F first
#define S second
using namespace std;
ll mode = 1e9 + 7;
const ll maxn = 1e6 + 5;
const ll inf = 1e18;
ll __lcm(ll a, ll b){ return (a*b)/__gcd(a,b); }
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll getRand(ll l, ll r){ uniform_int_distribution<int> uid(l, r); return uid(rng); }
template <class A, class B> ostream& operator << (ostream& out, const pair<A, B> &a) { return out << "(" << a.F << ", " << a.S << ")"; }
template <class A> ostream& operator << (ostream& out, const vector<A> &v) { 
out << "["; for (int i=0;i<v.size();i++) { if(i) out << ", "; out << v[i]; } return out << "]"; }

vector<ll> primes;

vector<ll> spf(maxn);
void sieve(){ 
    spf[1] = 1; 
    for (ll i=2; i<maxn; i++) 
        spf[i] = i; 
    for (ll i=4; i<maxn; i+=2) 
        spf[i] = 2; 
    primes.push_back(2);
  
    for (ll i=3; i<maxn; i++) { 
        if (spf[i] == i) {
            primes.push_back(i);
            for (ll j=i; j<maxn; j+=i) 
                if (spf[j]==j) 
                    spf[j] = i; 
        } 
    } 
}
map<ll,ll> fact(ll x) { 
    map<ll,ll> mp;
    while (x != 1) 
    { 
        mp[spf[x]]++;
        x = x / spf[x]; 
    } 
    return mp; 
}

ll get(ll a, ll b){
	if (a<=1) return 0;
	map<ll,ll> mp = fact(a);
    vector<ll> factor;
    for (auto i:mp){
        factor.push_back(i.first);
    }
    map<ll,ll> sub;
    ll n = factor.size();
    for (int i=1;i<(1<<n);i++){
        ll x = i;
        ll num = 1;
        for (int j=0;j<n;j++, x/=2){
            if (x&1){
                num *= factor[j];
            }
        }
        sub[i] += (b/num);
    }
    ll ans = 0;
    for (auto i:sub){
        ll count = __builtin_popcount(i.first);
        if (count%2) ans += i.second;
        else ans -= i.second;
    }
    ans = ans - (b/a);
    //if (spf[a]==a) ans += (b/a);
    return ans;
}

void solve(){
    
    ll l, r;
    cin>>l>>r;
    ll res = 0;
    for (int i=l;i<=r;i++){
    	ll add = get(i, r) - get(i, i-1);
    	//d3(i, get(i,r), get(i, i-1));
    	res += add;  	
	}
	res += res;
    cout<<res<<endl;
}


int main(){ 
    
    #ifndef ONLINE_JUDGE
//        freopen("input.txt", "r", stdin);
//        freopen("output.txt", "w", stdout);
    #endif
    srand(time(0)); 
    
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    
    sieve();
    ll test_case = 1;
    //cin>>test_case;
    for (int i=1;i<=test_case;i++){
        solve();
    }
    
    return 0;
}
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <set>

using namespace std;

long long int L, R;

long long int ans = 0;

int p[1000006];

vector<int>V;

long long int num[1000006];

int c[1000006];

vector<int> PRIME(int k) {
	vector<int> ret;
	for (auto y : V) {
		if (y*y > k) { break; }
		if (k <= 1) { break; }
		if (k%y == 0) {
			ret.push_back(y);
			while (k%y == 0) {
				k /= y;
			}
		}
	}

	if (k != 1) { ret.push_back(k); }

	return ret;
}

int main(void) {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	cin >> L >> R;

/*	for (int i = 2; i <= R; i++) {
		c[i] = 1;
	}

	for (int i=2; i <= R; i++) {
		if (c[i] == 1) {
			for (int j = i * 2; j <= R; j += i) {
				c[j] = 0;
			}
		}
	}
	for (int i = 2; i <= R; i++) {
		if (c[i] == 1) { V.push_back(i); }
	}
	*/

	for (int i = R; i >= 2; i--) {

		long long int r = R / i;
		long long int l = max((long long int)i-1, (L - 1)) / i;
		num[i] = (r-l)*(r-l);
		for (int j = i * 2; j <= R; j += i) {
			num[i] -= num[j];
		}
	}

	long long int ans = 0;

	for (int i = 2; i <= R; i++) {
		ans += num[i];
	}
/*	for (int i = 1; i <= 20; i++) {
		cout << "num[" << i << "]= " << num[i] << endl;
	}*/
	long long int sum1 = 0;

	for (long long int i = max(L,2LL); i <= R; i++) {
		for (int j = i * 2; j <= R; j += i) {
			sum1++;
		}
	}

	//cout << "sum1= " << sum1 << endl;
	ans -= sum1 * 2;

	ans -= (R - max(L,2LL) + 1);
	
	cout << ans << endl;

	return 0;
}
