#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstring>
#include <iostream>
#include <sstream>
#include <numeric>
#include <queue>
#include <vector>

using namespace std;

int64_t solve(int64_t L, int64_t R) {
	vector<int64_t> cnt(R + 1);
	for (int64_t g = R; g >= 2; --g) {
		cnt[g] = (R / g - (L - 1) / g) * (R / g - (L - 1) / g);
		for (int64_t x = g * 2; x <= R; x += g) {
			cnt[g] -= cnt[x];
		}
	}
	int64_t ans = accumulate(cnt.begin(), cnt.end(), 0LL);
	for (int g = max(int64_t(2), L); g <= R; ++g) {
		ans -= 2 * (R / g - (L - 1) / g) - 1;
	}
	return ans;
}

int main() {
	int64_t L, R;
	std::cin >> L >> R;
	cout << solve(L, R) << endl;
	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 ;
}