#include <bits/stdc++.h>

using namespace std;

using ll = long long;

const int MAXV = 1000000;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int l, r;
    cin >> l >> r;
    int n = r - l + 1;
    int m = r;
    vector<int> a(n);
    iota(a.begin(), a.end(), l);

    vector<int> is_prime(m + 1, true);
    vector<int> num(m + 1, 0);
    vector<int> fs(m + 1, 1);
    is_prime[0] = false;
    is_prime[1] = false;
    for (int i = 2; i <= m; i++) {
        if (!is_prime[i]) continue;
        num[i]++;
        fs[i] *= i;
        for (int j = 2 * i; j <= m; j += i) {
            is_prime[j] = false;
            num[j]++;
            fs[j] *= i;
        }
    }

    vector<int> cnt(m + 1, 0);
    for (int i = 0; i < n; i++) {
        if (a[i] <= m && fs[a[i]] == a[i]) cnt[a[i]]++;
        for (int j = 2; j * j <= a[i]; j++) {
            if (a[i] % j != 0) continue;
            if (j <= m && fs[j] == j) cnt[j]++;
            if (j * j == a[i]) continue;
            int k = a[i] / j;
            if (k <= m && fs[k] == k) cnt[k]++;
        }
    }

    vector<int> ans(m + 1, 0);
    for (int i = 2; i <= m; i++) {
        if (fs[i] != i) continue;
        for (int j = i; j <= m; j += i) {
            if (num[i] % 2 == 0) ans[j] -= cnt[i];
            else ans[j] += cnt[i];
        }
    }

    ll total_ans = 0;
    for (int i = l; i <= r; i++) {
        if (i == 1) continue;
        total_ans += ans[i] - 2 * (r / i - (l - 1) / i) + 1;
    }
    cout << total_ans << "\n";
    return 0;
}
#include <iostream>

using namespace std;

const int N = 1000010;

typedef long long LL;

LL f[N];
LL ans = 0;

int main() {
    int l, r;
    cin >> l >> r;
    for (int i = r; i >= 2; i --) {
        LL tem = r / i - (l - 1) / i;
        f[i] = tem * tem;
        for (int j = i * 2; j <= r; j += i)
            f[i] -= f[j];
        ans += f[i];
        //cout << i << ' ' << f[i] << endl;
    }

    for (int i = max(l, 2); i <= r; i ++) {
        LL tem = 0;
        for (int j = i; j <= r; j += i) {
            tem ++;
        }
        ans -= tem * 2 - 1;
    }
    cout << ans;
}
