#include <iostream>
#include <cmath>

using namespace std;

int main()
{
    int n;
    const int max_index = 1000000;
    int prime[max_index];

    prime[0] = 0;
    for (int i = 1; i < max_index; i++) 
        prime[i] = 1;

    for (int i = 1; i < (int)sqrt(max_index); i++) {
        if (prime[i] == 1)
            for (int j = i + 1; (i + 1) * j <= max_index; j++)
                prime[(i + 1) * j - 1] = 0;
    }

    int tmp = 0;
    for (int i = 0; i < max_index; i++) 
        (prime[i] == 0) ? (prime[i] = tmp) : prime[i] = ++tmp;
    prime[0] = 0;

    while (cin >> n) 
        cout << prime[n - 1] << endl;
    
    return 0;
}