#include<iostream>
#include<vector>
#include<string>
#include<cstdlib>
#include<cstring>
using namespace std;
#define MAX 1000000
bool prime[MAX];
int main(void){ 
  prime[0] = prime[1] = false;
  long long int ans[MAX];

  fill(prime,prime+MAX,true);
  fill(ans,ans+MAX,0);
  //for(int i = 0 ; i < 10 ; i ++)cout<<ans[i]<<endl;
  //ans[2] = 1;
  for(int i = 2 ; MAX > i * i ; i ++){
    ans[i] = ans[i-1] + prime[i];
    if(prime[i]){
      for(int j = i + i ; MAX > j * j ; j += i){
	prime[j] = false;
      }
    }
  }
  /*
  cout<<endl;
  for(int i = 0 ; i < 10 ; i ++)cout<<ans[i]<<endl;
  //*/
  int n;
  while(cin>>n){
    //cout<<n<<" ";
    cout<<ans[n]<<endl;
  }
 
}