#define PROBLEM "https://judge.yosupo.jp/problem/counting_primes"
#include"../template.h"
#include"Math/CheckPrime.h"voidsolve(){lln;cin>>n;cout<<Meissel(n);}
#line 1 "NumberTheory/Counting_primes.test.cpp"
#define PROBLEM "https://judge.yosupo.jp/problem/counting_primes"
#line 2 "template.h"
#include<bits/stdc++.h>usingnamespacestd;#define ll long long
#define MOD (ll)(1e9+7)
#define all(x) (x).begin(),(x).end()
#define unique(x) x.erase(unique(all(x)), x.end())
#define INF32 ((1ull<<31)-1)
#define INF64 ((1ull<<63)-1)
#define inf (ll)1e18
#define vi vector<int>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define fi first
#define se second
constintmod=998244353;voidsolve();intmain(){ios_base::sync_with_stdio(false);cin.tie(NULL);// cin.exceptions(cin.failbit);// int t; cin >> t;// while(t--)solve();cerr<<"\nTime run: "<<1000*clock()/CLOCKS_PER_SEC<<"ms"<<'\n';return0;}#line 2 "NumberTheory/Math/CheckPrime.h"
boolBruteForce(lln){if(n==2||n==3)returntrue;if(n<=1||n%2==0||n%3==0)returnfalse;for(lli=5;i*i<=n;i+=6)if(n%i==0||n%(i+2)==0)returnfalse;returntrue;}// https://codeforces.com/blog/entry/91632llMeissel(lln){vector<ll>v;for(lli=1;i*i<=n;i++){v.push_back(i);v.push_back(n/i);}sort(all(v));unique(v);llsq=sqrt(n);autogeti=[&](llx){if(x<=sq)returnx-1;return(int)v.size()-n/x;};vector<ll>dp=v;lla=0;for(llp=2;p*p<=n;p++){if(dp[geti(p)]==dp[geti(p-1)])continue;a++;for(inti=(int)v.size()-1;i>=0;i--){if(v[i]<p*p)break;dp[i]-=dp[geti(v[i]/p)]-a;}}returndp[geti(n)]-1;}#line 5 "NumberTheory/Counting_primes.test.cpp"
voidsolve(){lln;cin>>n;cout<<Meissel(n);}