#include using namespace std; #define ll long long #define rep(i,n) for(int i=0;i #define Tp tuple #define riano_ std::ios::sync_with_stdio(false);std::cin.tie(nullptr);typedef modint mint using Graph = vector>; const ll mod = 1000000007; template struct modint{ uint64_t val; constexpr modint(const int64_t val_=0) noexcept:val((val_%int64_t(mod)+int64_t(mod))%int64_t(mod)){} constexpr modint operator-() const noexcept{ return modint(*this)=mod-val; } constexpr modint operator+(const modint rhs) const noexcept{ return modint(*this)+=rhs; } constexpr modint operator-(const modint rhs) const noexcept{ return modint(*this)-=rhs; } constexpr modint operator*(const modint rhs) const noexcept{ return modint(*this)*=rhs; } constexpr modint operator/(const modint rhs) const noexcept{ return modint(*this)/=rhs; } constexpr modint &operator+=(const modint rhs) noexcept{ val+=rhs.val; val-=((val>=mod)?mod:0); return (*this); } constexpr modint &operator-=(const modint rhs) noexcept{ val+=((val>=1; } return (*this)*=now; } constexpr bool operator==(const modint rhs) noexcept{ return val==rhs.val; } constexpr bool operator!=(const modint rhs) noexcept{ return val!=rhs.val; } friend constexpr ostream &operator<<(ostream& os,const modint x) noexcept{ return os<<(x.val); } friend constexpr istream &operator>>(istream& is,modint& x) noexcept{ uint64_t t; is>>t,x=t; return is; } }; //素数判定 // nまでの整数に最小の素因数minfactorを与える vector min_factor; vector sieve(int n) { vector res(n+1); iota(res.begin(), res.end(), 0); for (int i = 2; i*i <= n; ++i) { if (res[i] < i) continue; for (int j = i*i; j <= n; j += i) { if (res[j] == j) res[j] = i; } } return res; } // nの素因数分解(上の"sieve"を前提とする) // (p1,n1),(p2,n2),... vector> factor(int n) { // min_factor は sieve() で得られたものとする vector> res; int p=-1,cnt=0; while (n > 1) { if(min_factor[n]!=p&&cnt>0){ res.push_back(make_pair(p,cnt)); p = min_factor[n]; cnt = 1; } else if(min_factor[n]!=p){ p = min_factor[n]; cnt = 1; } else cnt++; n /= min_factor[n]; // 割った後の値についても素因数を知っているので順次求まる } if(p!=-1) res.push_back(make_pair(p,cnt)); return res; } int main() { riano_; //ll ans = 0; ll L,R; cin >> L >> R; //main関数内 ll n = 1000001; min_factor = sieve(n); //nまでの素数判定 //vector> primefac = factor(k); //kの素因数分解 vector pr; rep(i,1000001){ if(i>=2&&min_factor[i]==i){ pr.push_back((ll)i); } } ll num[R-L+1]; bool sf[R-L+1]; rep(i,R-L+1){ num[i] = L+i; sf[i] = true; } for(ll x:pr){ ll sx = x*x; ll t = (L-1)/x; ll s = x*t+x; for(ll j=s;j<=R;j+=x){ ll k = j-L; if(j%sx==0) sf[k] = false; if(!sf[k]) continue; num[k] /= x; } } ll ans = 0; rep(i,R-L+1){ if(!sf[i]) continue; ll ss = floor(sqrt(num[i])); if(num[i]!=1&&ss*ss==num[i]) continue; ans++; } cout << ans << endl; }