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

#define MAX 1000000

int main(){
	bool p[MAX+1];
	int num,answer;

	while ( scanf("%d" , &num) != EOF ){	
		p[0] = false;
		p[1] = false;
		for (int i=2 ; i<=MAX ; i++){
			p[i] = true;
		}
		answer = 0;

		for (int i=2 ; i<=sqrt(MAX)+1 ; i++){
			if (p[i]==1){
				for (int j=i*2; j<=MAX; j=j+i){
					p[j] = false;
				}
			}
		}

		for (int i=0; i<=num; i++){
			if (p[i]){
				answer++;
			}
		}
		printf("%d\n", answer);
	}
	return 0;
}