#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <cstdio>
#include <limits>
#include <numeric>
#define rep(i,n) for(int i = 0; i < n; ++i)
#define rep1(i,n) for(int i = 1; i <= n; ++i)
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if(a < b){ a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if(a > b){ a = b; return 1; } return 0; }
template<class T> inline int  sz(T &a) { return a.size(); }
using ll = long long; using ld = long double;
using pi = pair<int,int>; using pl = pair<ll,ll>;
using vi = vector<int>; using vvi = vector<vi>;
using vl = vector<ll>; using vvl = vector<vl>;
const int inf = numeric_limits<int>::max();
const ll infll = numeric_limits<ll>::max();
class Osa_k{
public: 
  int max_number;
  vi min_factor;

  Osa_k(int N) : max_number(N) {
    Build();
  }

  void Build() {
    min_factor.resize(max_number+1);
    iota(min_factor.begin(),min_factor.end(), 0);
    for(int i = 2; i <= max_number; ++i) {
      if(min_factor[i] < i) continue;
      for(int j = 1; i*j <= max_number; ++j) {
        min_factor[i*j] = i;
      }
    }
  }

  vvi PrimeFactor() {
    vvi res(max_number+1);
    for(int i = 2; i <= max_number; ++i) {
      int num = i;
      while(num >= 2) {
        int factor = min_factor[num];
        res[i].push_back(factor);
        while(num % factor == 0) num /= factor;
      }
    }
    return res;
  }

  void Test() {
    vvi res = PrimeFactor();
    for(int i = 2; i <= max_number; ++i) {
      cout << i << "\n";
      for(auto tmp: res[i]) cout << tmp << " ";
      cout << "\n";
    }
  }

};
int main()
{
  ll l,r; cin >> l >> r;
  Osa_k os(r+1);
  vvi primeFactor = os.PrimeFactor();
  ll res = 0;
  for(int i = l; i <= r; ++i) {
    int n = sz(primeFactor[i]);
    rep1(S,(1<<n)-1){
      int prod = 1;
      rep(j,n) {
        if((S>>j)&1) prod *= primeFactor[i][j];
      }
      ll count = r/prod - (i-1)/prod;
      count -= r/i;
      if(__builtin_popcount(S) % 2 == 1) res += count;
      else res -= count;
    }
  }
  cout << res*2 << "\n";
  return 0;
}

#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;
}
