#include <iostream>
using namespace std;

int main() {
  int n;
  bool is_prime[1000000];
  int count;

  while (1) {
    cin >> n;
    if (cin.eof()) break;
    for (int i=2; i<=n; i++) is_prime[i] = true;

    for (int i=2; i*i<=n; i++) {
      if (is_prime[i]) {
        for (int j=i+i; j<=n; j+=i) {
          is_prime[j] = false;
        }
      }
    }

    count = 0;
    for (int i=2; i<=n; i++) {
      if (is_prime[i]) count++;
    }

    cout << count << endl;
  }

  return 0;
}