#include using namespace std; namespace sieve { std::vector primes, lpf; void init(int n) { if (n < int(std::size(lpf))) return; if (n < 2 * int(std::size(lpf))) n = 2 * std::size(lpf); lpf.resize(n + 1, -1); for (int d = 2; d <= n; ++d) { if (lpf[d] == -1) lpf[d] = d, primes.push_back(d); for (int p : primes) { if (p * d > n or p > lpf[d]) break; lpf[p * d] = p; } } } } // namespace sieve int main() { cin.tie(nullptr)->sync_with_stdio(false); int64_t l, r; cin >> l >> r; sieve::init(1e6); vector num(r - l + 1); iota(begin(num), end(num), l); vector> factor(r - l + 1); for (int p : sieve::primes) { for (auto i = r / p * p; i >= l; i -= p) { while (num[i - l] % p == 0) { num[i - l] /= p; factor[i - l].push_back(p); } } } int ans = 0; for (auto i = l; i <= r; ++i) { if (adjacent_find(begin(factor[i - l]), end(factor[i - l])) != end(factor[i - l])) { continue; } if (int64_t t = sqrtl(num[i - l]); t * t == num[i - l]) { continue; } ++ans; } cout << ans << '\n'; }