#include using namespace std; using ll = long long; const int mod = 1e9 + 7; const int inf = (1 << 30) - 1; const ll infll = (1LL << 61) - 1; vector eratosthenes(ll N) { vector res; vector prime(N + 1, 1); prime[0] = prime[1] = false; for (ll i = 2; i * i <= N; ++i) { if (prime[i] == true) { for (ll j = 2 * i; j <= N; j += i) { prime[j] = false; } } } prime[2] = false; for (ll i = 0; i <= N; ++i) { if (prime[i] == true) res.push_back(i); } return res; } template bool is_prime(T N) { if (N < 2) return false; for (T i = 2; i * i <= N; ++i) { if (N % i == 0) return false; } return true; } ll N, ans; int main() { cin >> N; auto prime = eratosthenes(N); int p = prime.size(); for (int i = 0; i < p && prime[i] * prime[i] - 2 <= N; i++) { if (is_prime(prime[i] * prime[i] - 2) && prime[i] * prime[i] - 2 <= N) { ans++; } } ans *= 2; if (N >= 2) ans++; cout << ans << endl; }