#include <string>
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>
#include <iomanip>


using namespace std;

typedef unsigned long long ull;

int main(void) {
	vector<int> dp = vector<int>(1000000, 0);
	int tmp = 0;
	for(int i = 2; i < 1000000; i++){
		if(dp[i] != 0)continue;
		dp[i] = ++tmp;
		for(int j = i * 2; j < 1000000; j += i){
			dp[j] = -1;
		}
	}
	int n;
	while(cin >> n){
		while(dp[n] == -1) n--;
		cout << dp[n] << endl;
	}
}