#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<int> computeMobius(int maxN) {
vector<int> mu(maxN + 1, 1);
vector<int> spf(maxN + 1, 0);
for(int i = 2; i <= maxN; ++i){
if(spf[i] == 0){
spf[i] = i;
for(int j = i * i; j <= maxN; j += i){
if(spf[j] == 0){
spf[j] = i;
}
}
}
}
for(int i = 2; i <= maxN; ++i){
if(spf[i/spf[i]] == spf[i]){
mu[i] = 0;
}
else{
mu[i] = -mu[i/spf[i]];
}
}
return mu;
}
ll countSquareFree(ll N, const vector<int> &mu) {
ll limit = sqrt(N);
ll res = 0;
for(ll k = 1; k <= limit; ++k){
res += (ll)mu[k] * (N / (k * k));
}
return res;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int T = 1;
// cin >> T;
int maxK = 31623;
vector<int> mu = computeMobius(maxK);
while(T--){
ll l, r;
cin >> l >> r;
ll sf_r = countSquareFree(r, mu);
ll sf_l_minus_1 = (l > 1) ? countSquareFree(l - 1, mu) : 0;
ll answer = sf_r - sf_l_minus_1;
if(l <=1 && r >=1){
answer -=1;
}
cout << answer << "\n";
}
}
CiNpbmNsdWRlIDxiaXRzL3N0ZGMrKy5oPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwp0eXBlZGVmIGxvbmcgbG9uZyBsbDsKCnZlY3RvcjxpbnQ+IGNvbXB1dGVNb2JpdXMoaW50IG1heE4pIHsKICAgIHZlY3RvcjxpbnQ+IG11KG1heE4gKyAxLCAxKTsKICAgIHZlY3RvcjxpbnQ+IHNwZihtYXhOICsgMSwgMCk7CiAgICBmb3IoaW50IGkgPSAyOyBpIDw9IG1heE47ICsraSl7CiAgICAgICAgaWYoc3BmW2ldID09IDApewogICAgICAgICAgICBzcGZbaV0gPSBpOwogICAgICAgICAgICBmb3IoaW50IGogPSBpICogaTsgaiA8PSBtYXhOOyBqICs9IGkpewogICAgICAgICAgICAgICAgaWYoc3BmW2pdID09IDApewogICAgICAgICAgICAgICAgICAgIHNwZltqXSA9IGk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9CiAgICBmb3IoaW50IGkgPSAyOyBpIDw9IG1heE47ICsraSl7CiAgICAgICAgaWYoc3BmW2kvc3BmW2ldXSA9PSBzcGZbaV0pewogICAgICAgICAgICBtdVtpXSA9IDA7CiAgICAgICAgfQogICAgICAgIGVsc2V7CiAgICAgICAgICAgIG11W2ldID0gLW11W2kvc3BmW2ldXTsKICAgICAgICB9CiAgICB9CiAgICByZXR1cm4gbXU7Cn0KCmxsIGNvdW50U3F1YXJlRnJlZShsbCBOLCBjb25zdCB2ZWN0b3I8aW50PiAmbXUpIHsKICAgIGxsIGxpbWl0ID0gc3FydChOKTsKICAgIGxsIHJlcyA9IDA7CiAgICBmb3IobGwgayA9IDE7IGsgPD0gbGltaXQ7ICsrayl7CiAgICAgICAgcmVzICs9IChsbCltdVtrXSAqIChOIC8gKGsgKiBrKSk7CiAgICB9CiAgICByZXR1cm4gcmVzOwp9CgppbnQgbWFpbigpewogICAgaW9zOjpzeW5jX3dpdGhfc3RkaW8oZmFsc2UpOwogICAgY2luLnRpZSgwKTsKICAgIGludCBUID0gMTsKICAgIC8vIGNpbiA+PiBUOwogICAgaW50IG1heEsgPSAzMTYyMzsKICAgIHZlY3RvcjxpbnQ+IG11ID0gY29tcHV0ZU1vYml1cyhtYXhLKTsKICAgIHdoaWxlKFQtLSl7CiAgICAgICAgbGwgbCwgcjsKICAgICAgICBjaW4gPj4gbCA+PiByOwogICAgICAgIGxsIHNmX3IgPSBjb3VudFNxdWFyZUZyZWUociwgbXUpOwogICAgICAgIGxsIHNmX2xfbWludXNfMSA9IChsID4gMSkgPyBjb3VudFNxdWFyZUZyZWUobCAtIDEsIG11KSA6IDA7CiAgICAgICAgbGwgYW5zd2VyID0gc2ZfciAtIHNmX2xfbWludXNfMTsKICAgICAgICBpZihsIDw9MSAmJiByID49MSl7CiAgICAgICAgICAgIGFuc3dlciAtPTE7CiAgICAgICAgfQogICAgICAgIGNvdXQgPDwgYW5zd2VyIDw8ICJcbiI7CiAgICB9Cn0=