#include using namespace std; vector prime; bool isprime[500001]; void eratos(void) { memset(isprime, true, sizeof(isprime)); for (int j = 2; j <= 500000; j++) { if (isprime[j]) { prime.push_back(j); for (int k = 2 * j; k <= 500000; k += j) { isprime[k] = false; } } } } int main(void) { cin.tie(0); ios::sync_with_stdio(false); eratos(); vector vec; long long int n; cin >> n; for (auto p : prime) { if (p * p > n) break; vec.push_back(p * p); } int res = 0; for (int i = 0; i < vec.size(); i++) { for (int j = 0; j < prime.size(); j++) { if (prime[j] > n) break; long long int c = vec[i] - prime[j]; if (c <= 1) break; if (isprime[c] && c<=n) res++; } } cout << res << '\n'; return 0; }