#include #include using namespace std; vector prime; void eratos(int n){ bool num[n+1]; fill(num,num+n+1,true); for(int i=2;i<=n;i++){ if(num[i]){ for(int j=i*2;j<=n;j+=i){ num[j]=false; } prime.push_back(i); } } } int main(){ int n,tmp,cnt=0; cin >> n; bool is_prime[n+1]; fill(is_prime,is_prime+n+1,false); eratos(n); for(int i=0;in)break; if(is_prime[tmp])cnt++; } cout << cnt << endl; }