#include<iostream>
#include<string.h>
int main(){int m,n=999999,o,c=n/2+1,d,i,e;bool*v=new bool[c];memset(v,1,c);for(i=m=1;i<499;){for(m=i++;!v[m];)m++;for(o=m*2+1,d=o*3;d<n+1;d+=o*2)v[d/2]=0;}for(;!(std::cin>>n).eof();){e=n>1;n&1?n:--n;for(i=1;i<n/2+1;)e+=v[i++];printf("%d\n",e);}delete[]v;}