#include <bits/stdc++.h>
 
#define ll long long
#define sz(x) ((int) (x).size())
#define all(x) (x).begin(), (x).end()
#define vi vector<int>
#define vl vector<long long>
#define pii pair<int, int>
#define REP(i,a) for (int i = 0; i < (a); i++)
#define add push_back
using namespace std;
template<typename T>
using minpq = priority_queue<T, vector<T>, greater<T>>;
 
const ll MOD = 1000000007LL;
//const ll MOD = 998244353LL;
 
int ni() {
    int x; cin >> x;
    return x;
}
 
ll nl() {
    ll x; cin >> x;
    return x;
}
 
double nd() {
    double x; cin >> x;
    return x;
}
 
string next() {
    string x; cin >> x;
    return x;
}

struct DisjointSetUnion {
    vi parent;
    vi weight;
    int count; //number of components

    DisjointSetUnion(int N) {
        count = N;
        parent.assign(N,0);
        REP(i,N) parent[i] = i;
        weight.assign(N,1);
    }

    //"find"
    int root(int p) {
        if (p==parent[p])
            return p;
        int r = root(parent[p]);
        parent[p] = r;
        return r;
    }

    //"union"
    void connect(int p, int q) {
        p = root(p);
        q = root(q);
        if (p==q) return;

        if (weight[p]<weight[q]) {
            parent[p] = q;
            weight[q] += weight[p];
        } else {
            parent[q] = p;
            weight[p] += weight[q];
        }
        count--;
    }

    bool connected(int p, int q) {
        return root(p)==root(q);
    }
};

ll in(int L, int R, int g) {
    int lo = (L+g-1)/g;
    int hi = R/g;
    return (hi-lo+1LL);
}

int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0);

    int L = max(2,ni());
    int R = ni();
    if (L>R) {
        cout << 0;
        return 0;
    }
    const int maxn = 1000000;
    ll dp[maxn+1];
    ll ans = 0LL;
    for (int i = R; i >= 2; i--) {
        dp[i] = in(L,R,i)*in(L,R,i);
        for (int j = 2*i; j <= R; j += i)
            dp[i] -= dp[j];
        ans += dp[i];
    }

    //remove people who divide each other
    ll bad = 0LL;
    for (int x = L; x < R; x++) {
        bad += in(x+1,R,x);
    }
    ans = ans-2*bad-(R-L+1);
    cout << ans;
}
#include <bits/stdc++.h>
using namespace std;

long long L, R;
long long T[1000005];

int main() {
  cin >> L >> R;

  if (L < 2) { L = 2; }
  long long ans = 0;
  for (int g = R; g >= 2; g--) {
    long long w = R/g - (L-1)/g;
    T[g] = w*w;
    for (int gg = g*2; gg <= R; gg+=g) {
      T[g] -= T[gg];
    }
    ans += T[g];
  }

  for (int i = L; i <= R; i++) {
    ans -= R/i*2-1;
  }
  cout << ans << endl;

  // long long ans2 = 0;
  // for (int x = L; x <= R; x++) {
  //   for (int y = x+1; y <= R; y++) {
  //     int g = gcd(x, y);
  //     if (g != 1 && x != g && y != g) { ans2 += 2; }
  //   }
  // }
  // cout << ans2 << endl;
}
