#include <bits/stdc++.h>
using namespace std;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  vector<bool> prime(1e6, true);
  prime[0] = prime[1] = false;
  for(int i = 2; i * i < 1e6; ++i) {
    if(prime[i]) {
      for(int j = i * i; j < 1e6; j += i) {
        prime[j] = false;
      }
    }
  }

  vector<int> cnt(1e6, 0);
  for(int i = 1; i <= 1e6; ++i) {
    cnt[i] = cnt[i - 1] + prime[i];
  }

  int n;
  while(cin >> n, !cin.eof()) {
    cout << cnt[n] << endl;
  }
}
