不用多说
#include <iostream>
using namespace std;
int n;
int prime[(int)(1e6 + 10)];
int main(){
cin >> n;int cnt = 0;
for (int i = 2; i <= n; i ++){
if (!prime[i]){
cnt ++;
for (int j = i + i; j <= n; j += i) prime[j] = 1;
}
}
cout << cnt;
return 0;
}