#include using namespace std; //conversion //------------------------------------------ inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;} template inline string toString(T x) {ostringstream sout;sout< inline T sqr(T x) {return x*x;} //typedef //------------------------------------------ typedef long long LL; typedef pair PII; typedef pair PLL; typedef vector VI; typedef vector VVI; typedef vector VLL; typedef vector VVLL; typedef vector VB; typedef vector VVB; typedef vector VD; typedef vector VVD; typedef vector VS; typedef vector VVS; typedef vector VC; typedef vector VVC; typedef vector VPII; typedef vector VPLL; typedef priority_queue PQGI; //大きい順 typedef priority_queue> PQLI; typedef priority_queue PQGP; typedef priority_queue> PQLP; //priority_queue,decltype(f)> pq{f}; //container util //------------------------------------------ #define ALL(a) (a).begin(),(a).end() #define RALL(a) (a).rbegin(),(a).rend() #define EB emplace_back #define EF emplace_front #define PB push_back #define PF push_front #define POB pop_back #define POF pop_front #define MP make_pair #define SZ(a) (int)((a).size()) #define SQ(a) ((a)*(a)) #define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i) #define EXIST(s,e) ((s).find(e)!=(s).end()) #define SORT(c) sort((c).begin(),(c).end()) #define SORTR(c) sort((c).rbegin(), (c).rend()) #define LB lower_bound #define UB upper_bound #define NEXP(a) next_permutation((a).begin(),(a).end()) #define FI first #define SE second #define Vmin(a) *min_element((a).begin(),(a).end()) #define Vmax(a) *max_element((a).begin(),(a).end()) //repetition //------------------------------------------ #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define REP(i,n) FOR(i,0,n) #define FORR(i,a,b) for(int i = (b-1);i>=(a);i--) #define REPR(i,n) FORR(i,0,n) #define CFOR(i,a,b) for(int i=(a);i<=(b);++i) #define CREP(i,n) CFOR(i,0,n) #define CFORR(i,a,b) for(int i = (b);i>=(a);i--) #define CREPR(i,n) CFORR(i,0,n) #define BFOR(bit,a,b) for(int bit = (a); bit < (1ll<<(b)); ++bit) #define BREP(bit,n) BFOR(bit,0,n) //constant //-------------------------------------------- const double EPS = 1e-10; const double PI = acos(-1.0); const int INF = INT_MAX/2; const LL LINF = LLONG_MAX/3; const int RINF = INT_MIN/2; const LL RLINF = LLONG_MIN/3; const LL MOD = 1e9+7; const LL MODD = 998244353; const int MAX = 510000; inline bool Eq(double a, double b) { return fabs(b - a) < EPS; } //other //------------------------------------------- templatebool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b>v;return v;} template T Vsum(vector &v){T res(0);for(auto&&x:v) res += x; return res; } template T Vgcd(vector &v){T res(0);for(auto&&x:v) res=gcd(res,x); return res; } template T Vlcm(vector &v){T res(1);for(auto&&x:v) res=lcm(res,x); return res; } #define COUT(x) cout << (x) << endl #define COUT2(x,y) cout << (x) << " " << (y) << endl #define COUT3(x,y,z) cout << (x) << " " << (y) << " " << (z) << endl #define BC(x) __builtin_popcountll(x) VI dx = {1,0,-1,0,1,1,-1,-1}; VI dy = {0,1,0,-1,1,-1,1,-1}; template< typename T1, typename T2 > istream &operator>>(istream &is, pair< T1, T2 > &p) { is >> p.first >> p.second; return is; } template< typename T1, typename T2 > ostream &operator<<(ostream &os, const pair< T1, T2 >& p) { os << p.first << " " << p.second; return os; } template< typename T > istream &operator>>(istream &is, vector< T > &v) { for(T &in : v) is >> in; return is; } template< typename T > ostream &operator<<(ostream &os, const vector< T > &v) { for(int i = 0; i < SZ(v); i++) { os << v[i] << (i + 1 != SZ(v) ? " " : ""); } return os; } template vector make_v(size_t a,T b){return vector(a,b);} template auto make_v(size_t a,Ts... ts){ return vector(a,make_v(ts...)); } struct FastFactor{ int n; VI min_factor; FastFactor(int _n):n(_n+1),min_factor(_n+1){ iota(ALL(min_factor),0); for(int i = 2; i*i < n; ++i){ if(min_factor.at(i) < i) continue; for(int j = i*i; j < n; j += i){ if(min_factor.at(j) == j) min_factor.at(j) = i; } } } map factor(int a){ map res; while(a > 1){ res[min_factor.at(a)]++; a /= min_factor.at(a); } return res; } bool isPrime(int p){ if(p<=1) return false; if(p>=n) return false; return p == min_factor.at(p); } VI prime_table(){ VI res; REP(i,n){ if(isPrime(i)) res.PB(i); } return res; } }; int main() { // cin.tie(0); // ios::sync_with_stdio(false); cout << fixed << setprecision(12); int N; cin >> N; if(N == 1){ COUT(0); return 0; } FastFactor ff(N); VI pt = ff.prime_table(); int ans = 0; for(auto p : pt){ if(p==2)continue; LL q = (LL)p*p-2; if(q>N){ //if(ff.isPrime(q))COUT(q); continue; } if(ff.isPrime(q)) ans++; } ans *= 2; ans++; COUT(ans); return 0; }