#include <stdio.h>

int main(void)
{
	int n;
	int ans;
	char prime[1000000];
	int i, j;
	int p;
	
	while (scanf("%d", &n) != EOF){
	
		for (i = 0; i < n + 1; i++){
			prime[i] = 1;
		}
		prime[0] = prime[1] = 0;
		
		for (i = 2, p = 0; i <= n + 1; i++){
			if (prime[i]){
				for (j = 2 * i; j <= n; j += i){
					prime[j] = 0;
				}
			}
		}
		for (i = 0, p = 0;i <= n; i++){
			if (prime[i] == 1){
				p++;
			}
		}
		
		ans = p;
		printf("%d\n", ans);
		}
	
	return (0);
}