/*
- Featured Article -
Reimu Hakurei is one of the main characters of the Touhou Project
series, having appeared in almost every game in the series.
As the sole maiden of the Hakurei Shrine, she is commonly called
upon (or calls it upon herself) to investigate strange occurrences
throughout Gensokyo. In earlier games, Reimu's spiritual abilities
were highly limited. (In Highly Responsive to Prayers, she was
unable to directly harm enemies at all.) As time passed, however,
she developed her abilities, becoming able to manipulate the
Hakurei Yin-Yang Orb, special amulets, and her own spiritual power
to fight more effectively. Sometime between Mystic Square and
Embodiment of Scarlet Devil, she realized...
*/
#include <bits/stdc++.h>
using namespace std;
#define N 1000000

int main(){
    bool cmp[N]={true};
    int npr[N];
    for(int i=2;i<N;i++){
        if(!cmp[i]){
            for(int j=2;i*j<N;j++)cmp[i*j]=true;
        }
        npr[i]=npr[i-1]+!cmp[i];
    }
    int data[30],i;
    for(i=0;cin>>data[i];i++);
    for(int j=0;j<i;j++){
        cout<<npr[data[j]]<<endl;
    }
}