#include <stdio.h>
 
#define MN 
 
int main(void)
{
    int n;
    int i, j;
	long LN = 1000001;
    int pn[1000001];
     
    for (i = 0; i < LN; i++){
        pn[i] = 1;
    }
     
    pn[0] = pn[1] = 0;
     
    for (i = 2; i * i < LN; i++){
        if (pn[i] == 1){
            for (j = i * i; j < LN; j += i){
                pn[j] = 0;
            }
        }
    }
     
    for (i = 1; i < LN - 1; i++){
        pn[i + 1] += pn[i];
    }
     
    while (cin >> n){
    	cout << pn[n] << endl;
    }
     
    return (0);
}