#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#define ff                  first
#define ss                  second
#define pb                  push_back
#define eb                  emplace_back
#define mp                  make_pair
#define lb                  lower_bound
#define ub                  upper_bound
#define setbits(x)          __builtin_popcountll(x)
#define zrobits(x)          __builtin_ctzll(x)
#define sz(v)               (int)v.size()
#define ps(y)               cout << fixed << setprecision(y)
#define ms(arr, v)          memset(arr, v, sizeof(arr))
#define all(v)              v.begin(), v.end()
#define rall(v)             v.rbegin(), v.rend()
#define trav(x, v)          for(auto &x: v)
#define w(t)                int t; cin >> t; while(t--)
#define rep0(i, n)          for(int i = 0; i < n; i++)
#define rrep0(i, n)         for(int i = n - 1; i >= 0; i--)
#define rep1(i, n)          for(int i = 1; i <= n; i++)
#define rrep1(i, n)         for(int i = n; i > 0; i--)
#define inp(arr, n)         rep0(i, n) cin >> arr[i];
#define rep(i, a, b)        for(int i = a; i <= b; i++)
#define rrep(i, a, b)       for(int i = a; i >= b; i--)

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef map<ll, ll> mii;
typedef map<char, ll> mci;
typedef priority_queue<ll> pq_mx;
typedef priority_queue<ll, vi, greater<>> pq_mn;
typedef tree<ll, null_type, less<>, rb_tree_tag, tree_order_statistics_node_update> pbds;
/*
 * find_by_order(i) -> returns an iterator to the element at ith position (0 based)
 * order_of_key(i)  -> returns the position of element i (0 based)
 */

const int N = 2e6 + 5;
const int mod = 1e9 + 7;
//const int mod = 998244353;
const ll inf = 1e18;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void fio() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
}

const int M = 1e7 + 5;
ll spf[M], mobius[M];
vi primes;

void sieve() {
    rep(x, 2, 1e7) {
        if (spf[x] == 0) spf[x] = x, primes.pb(x);
        for (int y = 0; y < sz(primes) and primes[y] <= spf[x] and x * primes[y] <= 1e7; y++)
            spf[x * primes[y]] = primes[y];
    }
}

void Mobius() {
    /*
     * mobius[x] =  1 => x is a square-free +ve int with even no. of prime factors
     * mobius[x] = -1 => x is a square-free +ve int with odd no. of prime factors
     * mobius[x] =  0 => x has a squared prime factor
     */

    rep1(x, 1e7) {
        if (x == 1) mobius[x] = 1;
        else {
            if (spf[x] == spf[x / spf[x]]) mobius[x] = 0;
            else mobius[x] = -mobius[x / spf[x]];
        }
    }
}

int main() {
    fio();
    sieve();
    Mobius();

    int l, r;
    cin >> l >> r;
  	if(l == 1) ++l;

    ll res = 0;
    rep(x, 2, r) {
        ll cur = r / x - (l - 1) / x;
        res -= cur * cur * mobius[x];
    }
//    cout << res << endl;
    rep(x, l, r) {
        --res;
        for (int y = 2 * x; y <= r; y += x) res -= 2;
    }
    cout << res;

    return 0;
}
#pragma GCC optimize(2)
#include <cstdio>
#include <vector>
#include <iostream>
using namespace std;
#define int long long
#define maxn 1000005
vector < int > d[maxn];
int cnt;
bool vis[maxn];
int prime[maxn], mu[maxn], pre[maxn];

void init( int n ) {
	mu[1] = 1;	
	for( int i = 2;i <= n;i ++ ) {
		if( ! vis[i] ) prime[++ cnt] = i, mu[i] = -1;
		for( int j = 1;j <= cnt && i * prime[j] <= n;j ++ ) {
			vis[i * prime[j]] = 1;
			if( i % prime[j] == 0 ) {
				mu[i * prime[j]] = 0;
				break;
			}
			mu[i * prime[j]] = -mu[i];
		}
	}
	for( int i = 1;i <= n;i ++ ) pre[i] = pre[i - 1] + mu[i];
}

int calc( int n, int m ) {
	if( n > m ) swap( n, m );
	int last, ans = 0;
	for( int i = 1;i <= n;i = last + 1 ) {
		last = min( n / ( n / i ), m / ( m / i ) );
		ans += ( pre[last] - pre[i - 1] ) * ( n / i ) * ( m / i );
	}
	return ans;
}

signed main() {
	int L, R;
	scanf( "%lld %lld", &L, &R );
	init( R );
	int ans = 0;
	for( int k = 2;k <= R;k ++ ) {
		int l = ( L - 1 ) / k, r = R / k;
		ans += calc( r, r ) - calc( l, r ) - calc( r, l ) + calc( l, l );
	}
	for( int i = 2;i <= R;i ++ )
		for( int j = i << 1;j <= R;j += i )
			d[j].push_back( i );
	for( int i = max( 2ll, L );i <= R;i ++ ) {
		for( int j = d[i].size() - 1;~ j;j -- )
			if( d[i][j] >= L ) ans --;
			else break;
		ans -= ( R / i );
	}
	printf( "%lld\n", ans );
	return 0;
}
