#include <iostream>

using namespace std;

const int N = 1000010;

typedef long long LL;

LL f[N];
LL ans = 0;

int main() {
    int l, r;
    cin >> l >> r;
    for (int i = r; i >= 2; i --) {
        LL tem = r / i - (l - 1) / i;
        f[i] = tem * tem;
        for (int j = i * 2; j <= r; j += i)
            f[i] -= f[j];
        ans += f[i];
        //cout << i << ' ' << f[i] << endl;
    }

    for (int i = max(l, 2); i <= r; i ++) {
        LL tem = 0;
        for (int j = i; j <= r; j += i) {
            tem ++;
        }
        ans -= tem * 2 - 1;
    }
    cout << ans;
}

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template <typename T> using indexed_set = tree<T, null_type,less<T>, rb_tree_tag,tree_order_statistics_node_update>;
template <typename T> using indexed_multiset = tree<T, null_type,less_equal<T>, rb_tree_tag,tree_order_statistics_node_update>;
#define int long long
#define ll long long
#define vi vector<int>
#define pii pair<int,int>
#define vii vector<pii>
#define mii map<int,int>
#define rep(i, begin, end) for (int i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define pb push_back
#define mp make_pair
#define file freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define endl "\n"
#define ff first
#define ss second
#define PI 3.14159265358979323846
#define forn(i, n) for (int i = 0; i < (int)n; ++i)
#define bit(x,j) ((x>>j)&1)
#define sz(a) (int)((a).size())
#define PRINT(v) for(auto t:v) cout<<t<<" ";cout<<endl;
#define PRINTDP(v) for(auto t:v){for(auto u:t){ cout<<u<<" ";} cout<<endl;}
#define PRINTM(mpp) for(auto t:mpp) cout<<t.ff<<" "<<t.ss<<endl;
#define read(v,n) vector<int> v(n); rep(i,0,n) cin>>v[i];
const int MOD=1e9+7 ;
const int MOD2=998244353;
const int INF=1e18+5;
int nCr(int n, int k) { if(k>n) return 0; double res = 1; for (int i = 1; i <= k; ++i) res = res * (n - k + i) / i; return (int)(res + 0.01); }
int gcd(int a,int b){ return b? gcd(b,a%b):a; }
template<typename T,typename T1>T amax(T &a,T1 b){if(b>a)a=b;return a;}
template<typename T,typename T1>T amin(T &a,T1 b){if(b<a)a=b;return a;}
template<typename T,typename T1>T add_self(T &a,T1 b,T m=MOD){return a=((a%m+b%m)%m);}
const int N= 1e6+5;
int mob[N+2];
vector<int> primes;
int lp[N+1];
void linear_sieve(){
    for(int i=2;i<=N;i++){
        if(lp[i]==0){
            lp[i]=i;
            primes.push_back(i);
        }

        for(int j=0;j<sz(primes) && primes[j]<=lp[i] && i*primes[j]<=N;j++)
            lp[i * primes[j]] = primes[j];
    }
}


void precompute(){
    mob[1]=1;
    rep(i,2,N+1){
       mob[i] = [](int x){
            int cnt=0;
            while(x>1){
                int p=lp[x];
                int k=0;
                while(x%p==0){
                    x/=p;
                    k++;
                }
                if(k>1) return 0;
                ++cnt;
            }
            if(cnt & 1)
                return -1;
            else
                return 1;
       }(i);
    }
}

void solve(){
    int l,r;
    cin>>l>>r;
    if(l==1) l++;
    int ans=0;

    rep(g,2,N){
        int cnt= r/g - (l-1)/g; // Coprime pairs in [l,r]
        ans -= mob[g]*cnt*cnt;
    }

    // Removing pairs such as (x,kx) and (kx,x)

    rep(i,l,r+1){
        for(int j=i;j<=r;j+=i){
            ans--;
            if(i!=j)
                ans--;
        }
    }

    cout<<ans<<endl;



    
 
}

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.precision(17);
    int t=1;
    linear_sieve();
    precompute();
    // cin>>t;
    while(t--)
    solve();

    return 0;
}
