#include using namespace std; #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define REP(i,n) FOR(i,0,n) #define ALL(v) begin(v),end(v) template inline bool chmax(A & a, const B & b) { if (a < b) { a = b; return true; } return false; } template inline bool chmin(A & a, const B & b) { if (a > b) { a = b; return true; } return false; } using ll = long long; using pii = pair; constexpr ll INF = 1ll<<30; constexpr ll longINF = 1ll<<60; constexpr ll MOD = 998244353; constexpr bool debug = false; //---------------------------------// std::vector sieve_smallest_prime_factor(int n) { assert(n >= 0); std::vector res(n + 1); std::iota(begin(res), end(res), 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; } int main() { int N; cin >> N; auto spf = sieve_smallest_prime_factor(N); vector sq; // N 以下の平方数 FOR(i, 1, N + 1) { if (i * i > N) break; sq.emplace_back(i * i); } ll ans = 0; FOR(i, 1, N + 1) { ll p = 1; // i * p が平方数となる最小の p int prv = -1, o = false; for (int cur = i; cur > 1;) { if (prv != spf[cur]) { if (o) p *= prv; prv = spf[cur]; o = true; } else o ^= 1; cur /= spf[cur]; } if (o) p *= prv; if (p > N) break; // pd <= x となる d の最大値(d は平方数) ans += upper_bound(ALL(sq), N / p) - sq.begin(); } cout << ans << endl; }