#include using namespace std; typedef long long ll; #define REP(i,n) for(int i=0; i #define VLL vector #define VVI vector> #define VVLL vector> #define VC vector #define VS vector #define VVC vector> #define VB vector #define VVB vector> #define fore(i,a) for(auto &i:a) typedef pair P; template bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } const int INF = 1 << 30; const ll INFL = 1LL << 60; const ll mod = 998244353; int max_prime = 1000005; vector isprime(max_prime, true); void solve() { isprime[0] = false; isprime[1] = false; isprime[2] = true; for (int j = 2; 2*j < max_prime; j++) { isprime[2 * j] = false; } for (int i = 3; i < max_prime; i += 2) { if (!isprime[i])continue; for (int j = 2; i*j < max_prime; j++) { isprime[i*j] = false; } } } int main() { int n; cin >> n; ll ans = 0; solve(); for (ll i = 2; i*i - 2 <= n; i++) { if (!isprime[i])continue; if (isprime[i*i - 2]) { if (i == 2) { ans++; } else ans += 2; } } cout << ans << endl; }