#include<bits/stdc++.h>
#define            pb            push_back
#define            pl            pair<ll,ll>
#define            pll           pair<ll,pair<ll,ll>>
#define            ll            long long
#define            vl            vector<ll>
#define            fastio        ios_base::sync_with_stdio(false); cin.tie(NULL);
#define            mp            make_pair
#define            w(t)          int t;cin>>t;while(t--)
#define            inf           1e18
#define            fi(a,n)       for(ll i=a;i<n;i++)
#define            fr(i,a,b)     for(ll i=a;i>=b;i--)
#define            fj(a,n)       for(ll j=a;j<n;j++)
#define            k(a,n)        for(ll k=a;k<n;k++)
#define            endl          "\n"
#define            all(v)        (v).begin(),(v).end()
#define            set1(x)       __builtin_popcount(x)
#define            gcd(a,b)      __gcd(a,b)
#define mem1(a)           memset(a,-1,sizeof(a))
#define mem0(a)           memset(a,0,sizeof(a))
using namespace std;
const ll mod= 1000000007;
const ll N =1000005;
ll v[N];
vl m(N,1);
ll f[N];
void seive()
{
  m[1]=1;
  fi(2,N)
  {
    if(!v[i])
    {
      for(ll j=i;j<N;j+=i)
      {

        if(j%(i*i)==0)m[j]=0;
        m[j]=-m[j];
        v[j]=1;
      }
    }
  }
}
void solve()
{
  ll l,r;
  cin>>l>>r;
  fi(l,r+1)
  {
    f[i]++;
  }
  ll ans=0;
  // fi(1,10)cout<<m[i]<<endl;
  fi(1,r+1)
  {
    if(m[i]==0)continue;
    ll temp=0;
    for(ll j=i;j<r+1;j+=i)
    {
       temp+=(f[j]);
    }
    // cout<<i<<" "<<temp<<endl;
    ans+=(temp*(temp-1)/2*m[i]);
  }
  ll x=r-l+1;
  ans=((x*(x-1))/2)-ans;
  // cout<<ans<<endl;
  ll kk=0;
  fi(max(2LL,l),r+1)
  {
    for(ll j=i;j<r+1;j+=i)
    {
       if(i==j)continue;
       else kk++;
    }
  }

  cout<<2*(ans-kk)<<endl;
}
int main()
{
  ios_base::sync_with_stdio(false);
    cin.tie(NULL);
  #ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
#endif
      // w(t)
       seive();
      solve();

}
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;
#define pb push_back
#define ll long long int
#define pll pair<ll,ll>
#define mp make_pair
# define fio ios_base::sync_with_stdio(false); cin.tie(NULL)

const int MAX_N = 2e6+1;

ll mod = 1e9+7;

int main()
{
    fio;

    int l,r;
    cin>>l>>r;
  
    ll store[r+1];
    ll ans = 0;
    
    for(int i=r;i>=2;i--){
        store[i]  =0;
        for(int j=i;j<=r;j+=i){
            store[i] -= store[j];
        }
        ll low = (l-1)/i;
        ll high = r/i;
        store[i] += (high-low) * (high-low);
        ans += store[i];
    }

    for(int i=max(2,l);i<=r;i++){
        ll high = r/i;
        ans -= (2*high - 1);
    }
    cout<<ans;
    return 0;
}
