#include #include #include #include #include #include #include #include #include #include #include #include #define debug_value(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << #x << "=" << x << endl; #define debug(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << x << endl; template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } using namespace std; typedef long long ll; class Eratosthenes{ public: int m; vector is_prime; vector primes; Eratosthenes(int m_){ m = m_; init(); } private: void init(){ is_prime.assign(m+1, true); is_prime[0] = false, is_prime[1] = false; for(int i = 2; i <= m; i++){ if(is_prime[i]){ primes.push_back(i); for(int j = 2; i*j <= m; j++) is_prime[i*j] = false; } } } }; // calc a//b template T ceil_div(T a, T b){ return (a+b-1)/b; } ll sqrt_ll(ll x){ ll ans = sqrt(x)+0.1; if(ans*ans > x) ans--; return ans; } int main(){ ios::sync_with_stdio(false); cin.tie(0); cout << setprecision(10) << fixed; auto erat = Eratosthenes(1000001); ll l, r; cin >> l >> r; int n = r-l+1; vector square_free(n, true); vector val(n); for(int i = 0; i < n; i++) val[i] = l+i; for(ll p : erat.primes){ int x = ceil_div(l, p); for(ll y = x*p; y <= r; y += p){ int idx = y-l; if(val[idx]%(p*p) == 0){ square_free[idx] = false; } while(val[idx]%p == 0) val[idx] /= p; } } int ans = 0; for(ll x = l; x <= r; x++){ int idx = x-l; if(!square_free[idx]) continue; ll sq = sqrt_ll(val[idx]); // cout << val[idx] << endl; if(sq > 1000000 && sq*sq != val[idx]) continue; ans++; } cout << ans << endl; }