#include<cstdio>
const int maxn = 1000010;
int prime[maxn + 10];
int main(){
	for(int i = 2; i <= maxn; i++){
		if(!prime[i]) prime[++prime[0]] = i;
		for(int j = 1; j <= prime[0] && prime[j] <= maxn / i; j++){
			prime[prime[j] * i] = true;
			if(i % prime[j] == 0) break;
		}
	}
	int n;
	while(scanf("%d", &n) == 1){
		int l = 0, r = prime[0] + 1;
		while(r - l > 1){
			int m = (l + r) / 2;
			if(prime[m] <= n) l = m;
			else r = m;
		}
		printf("%d\n", l);
	}
	return 0;
}