#include <cstdio>
#include <iostream>

using namespace std;

const int MAX_N = 1000000;

int N;

int len;
int prime[MAX_N];				//save all prime number less than MAX_N
bool isPrime[MAX_N];

void sieve(){
	//init
	fill(isPrime, isPrime + MAX_N, true);
	isPrime[0] = isPrime[1] = false;
	
	for(int i = 2; i < MAX_N; i ++){
		if(isPrime[i]){
			prime[len ++] = i;
			for(int j = 2 * i; j < MAX_N; j += i)
				isPrime[j] = false;
		}
	}
}

void solve(){
	for(int i = len - 1; i >= 0; i --){
		if(N >= prime[i]){
			printf("%d\n", i+1);
			return;
		}
	}
	printf("0\n");
}

int main(int argc, char const *argv[]){

	sieve();
	while(scanf("%d", &N) != EOF){
		solve();
	}

	return 0;
}