    #include <bits/stdc++.h>
    using namespace std;
    #include <math.h>
    #include <iomanip>
    #include <cstdint>
    #include <string>
    #include <sstream>
    template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
    template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
    #define rep(i,n) for (int i = 0; i < (n); ++i)
    typedef long long ll;
    using P=pair<ll,ll>;
    const ll INF=1e18;
    const int mod=1e9+7;
    
    void solve(){
        ll l,r;
        cin>>l>>r;
        vector<ll>x(r+1);
        ll ans=0;
        for(int i=r;i>=2;i--){
          ll p=r/i-(l-1)/i;
          x[i]=p*p;
          for(int j=2*i;j<=r;j+=i){
            x[i]-=x[j];
          }
          ans+=x[i];
        }
        for(ll i=l;i<=r;i++){
          if(i==1){continue;}
          ans-=r/i*2-1;
        }
        cout<<ans<<endl;
    }
     
    int main(){
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        
        solve();
        
        return 0;
    }
#include <bits/stdc++.h>
using namespace std ;
typedef long long ll ;
typedef pair<int,int> P ;
#define rep(i,n) for(int i = 0 ; i < n ; i++)
#define rrep(i,a,b) for(int i = a ; i < b ; i++)

int l , r ;

int A[1000007] ;
int ans[1000007] ;
int prime_factor[1000007] ;

void ertstns(){
    memset(prime_factor,-1,sizeof(prime_factor)) ;
    prime_factor[0] = prime_factor[1] = 1 ;
    for(int i = 2 ; i < 1000007 ; i++){
        if(prime_factor[i] == -1){
            for(int j = i ; j < 1000007 ; j += i) prime_factor[j] = i ;
        }
    }
}


int main(){
    ertstns() ;
    cin >> l >> r ;
    rrep(i,max(l,2),r+1){
        int k = i ;
        vector<int> vec ;
        map<int,bool> use ;
        while(k != 1){
            if(!use[prime_factor[k]]) vec.push_back(prime_factor[k]) ;
            use[prime_factor[k]] = true ;
            k /= prime_factor[k] ;
        }
        int t = vec.size() ;
        for(int S = 1 ; S < 1 << t ; S++){
            ll val = 1 ;
            for(int bit = 0 ; bit < t ; bit++){
                if(S >> bit & 1) val *= vec[bit] ;
            }
            ans[val]++ ;
        }
    }
    ll res = 0 , mns = 0 ;
    for(int i = max(l,2) ; i <= r ; i++){
        int k = i ;
        vector<int> vec ;
        map<int,bool> use ;
        while(k != 1){
            if(!use[prime_factor[k]]) vec.push_back(prime_factor[k]) ;
            use[prime_factor[k]] = true ;
            k /= prime_factor[k] ;
        }
        int t = vec.size() ;
        for(int S = 1 ; S < 1 << t ; S++){
            ll count = 0 , val = 1 ;
            for(int j = 0 ; j < t ; j++) if(S >> j & 1){
                count++ ;
                val *= vec[j] ;
            }
            if(count % 2 == 0) res -= ans[val] ;
            else res += ans[val] ;
        }
        if(i * 2 <= r) mns += 2 * (r / i - 1) ;
        mns++ ;
    } 
    cout << res - mns << endl ;
}