#include using namespace std; using ll = long long; using ld = long double; vector sieve_of_atkin(int N){ vector isprime(N + 1); const int sqrtN = sqrt(N); int n; for(int z = 1; z <= 5; z += 4) for(int y = z; y <= sqrtN; y += 6){ for(int x = 1; x <= sqrtN && (n = 4*x*x+y*y) <= N; ++x) isprime[n] = !isprime[n]; for(int x = y+1; x <= sqrtN && (n = 3*x*x-y*y) <= N; x += 2) isprime[n] = !isprime[n]; } for(int z = 2; z <= 4; z += 2) for(int y = z; y <= sqrtN; y += 6){ for(int x = 1; x <= sqrtN && (n = 3*x*x+y*y) <= N; x += 2) isprime[n] = !isprime[n]; for(int x = y+1; x <= sqrtN && (n = 3*x*x-y*y) <= N; x += 2) isprime[n] = !isprime[n]; } for(int y = 3; y <= sqrtN; y += 6) for(int z = 1; z <= 2; ++z){ for(int x = z; x <= sqrtN && (n = 4*x*x+y*y) <= N; x += 3) isprime[n] = !isprime[n]; } for(int n = 5; n <= sqrtN; ++n) if(isprime[n]) for(int k = n*n; k <= N; k+=n*n) isprime[k] = false; isprime[2] = isprime[3] = true; return isprime; } vector primes(int N){ auto isprime = sieve_of_atkin(N); vector ans; for(int i = 2; i <= N; i++) if(isprime[i]) ans.push_back(i); return ans; } constexpr ll siz = 3.2e6; int main(){ auto P = primes(siz); ll L = 1e18 - 1e6, R = 1e18; cin >> L >> R; vector A_(R - L + 1, 1); auto A = A_.begin() - L; for(ll p : P){ p *= p; for(ll i = R - R % p; i >= L; i -= p) A[i] = 0; } for(ll k = 1; k <= (ll)1e18 / siz / siz; k++){ const ll lo = max(siz, ceil(sqrt((ld)L / k))), hi = sqrtl(R / k); for(ll i = lo; i <= hi; i++) A[k * i * i] = 0; } cout << reduce(A_.begin(), A_.end(), 0) << endl; }