#include<stdio.h>
#include<math.h>

/*??????????????¨?????¢??°       */
/*????????????0????????\????????¨???*/
void print_rist(char *rist, int num){
	int i = 2;
	
	while(i <= num) {
		if (rist[i] != 0) {
			printf("%d ", i);
		}
		i++;
	}
	printf("\n");
}


main(){
	char rist[1000001];
	int i, j;
	int input_num = 0;
	int count;
	int ans;
	
	/*??????????????§????´???°????±???????????????\???*/
	for(j = 0; j < 30; j++) {
		scanf("%d", &input_num);
		if (input_num == EOF) {
			break;
		}
		/*??¢?´¢??????????????????*/
		for (i = 1; i <= input_num; i++) {
			rist[i] = 1;
		}	
		rist[i] = 0;
		rist[1] = 0;
		/*?´???°??????????????????*/
		count = 2;
		while((count * count) <= input_num) {	/*???input_num??????????????§*/
			i = 2;
			/*count??\??????count????????°??????????????¨???*/
			while((i * count) <= input_num) {
				rist[i * count] = 0;
				i++;
			}
			count++;
			/*?¬????count?????????*/
			while(rist[count] != 1) {
				count++;
			}
			
		}
		
		ans = 0;
		for (i = 1; i <= input_num; i++) {
			if (rist[i] == 1) {
				ans++;
			}
		}
		printf("%d\n", ans);
		//print_rist(rist, input_num);
	}
	return 0;
}