#include<iostream>
#include<vector>
#include<string>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<cstdio>
using namespace std;
#define MAX 1000000
bool prime[MAX];
int main(void){ 
  
  prime[0] = prime[1] = false;
  //memeset(prime,sizeof(prime),true);
  fill(prime,prime+MAX,true);
  long long int ans[MAX];
  
  ans[0] = ans[1] = 0;
  ans[2] = 1;
  int now=0;
  
  for(long long int i = 2 ; MAX >= i ; i ++){
    ans[i] = now ;
    //cout<<now<<" "<<ans[i]<<endl;
    if(prime[i]){
      //cout<<i<<endl;
      now ++;
      for(long long int j = i + i ; MAX > j ; j += i){
	prime[j] = false;
      }
    }
  }
  
  long long int n;
  while(cin>>n){
    cout<<ans[n]<<endl;
  }
  
}