Go: package main
import (
	"fmt"
	"os"
	"strconv"
	"bufio"
	//"math"
)

var sc = bufio.NewScanner(os.Stdin)

func main(){
	for sc.Scan(){
		n := nextInt()
		fmt.Println(calc(n))
	}
}

func calc(n int)int{
	// エラトステネスで数え上げる
	// 最初から999999まで用意しておいて入力のたびO(1)で出すのとどっちが速いのかはわからん
	eratos := make([]bool, n+1)
	c := 0
	for i:=2; i<len(eratos); i++{
		if eratos[i] == false{
			c++
			for j:=i*i; j<len(eratos); j+=i{
				eratos[j]=true
			}
		}
	}
	return c
}

func next()string{
	return sc.Text()
}

func nextInt()int{
	a, _ := strconv.Atoi(next())
	return a
}

C++: #include <cstdio>
using namespace std;

int main(){
	const int MAX_n = 1000000;
	int n;
	bool prime[MAX_n];
	int res;
	
	for(int i = 0; i < MAX_n; i++) prime[i] = false;
	
	for(int i = 2; i < MAX_n; i++){
		if(!prime[i]){
			//printf("%d\n", i);
			for(int j = i + i; j < MAX_n; j += i){
				prime[j] = true;
				
			}
		}
	}
	
	//for(int i = 0; i < MAX_n; i++) if(prime[i]) printf("%d\n", i);
	
	while((scanf("%d", &n)) != EOF){
		res = 0;
		
		for(int i = 2; i <= n; i++){
			if(!prime[i]){ res++; }
		}
		
		printf("%d\n", res);
	}
	
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
 
#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false
 
typedef long long ll;
typedef pair<int, int> ii;

int main(){

	vector<bool> used(1000000);
	set<ll> prime;
	
	REP(i, 2, 1000000){
		if(!used[i]) prime.insert(i);
		for(int j = 1; i * j < 1000000; j++){
			used[i*j] = true;
		}
	}
	
	int n;
	while(cin >> n){
		auto it = upper_bound(prime.begin(), prime.end(), n);
		cout << distance(prime.begin(), it) << endl;
	}
	
	
	return 0;
}

C++: <?php
$max=1000000;
$maxR=floor(sqrt($max));

$ch=[0,0,1,1];

for($i=4;$i<$max;$i+=2){
  $ch[]=0;$ch[]=1;
}

for($i=3;$i<$maxR;$i+=2){
  if($ch[$i]){
    for($j=$i+$i;$j<$max;$j+=$i){
      $ch[$j]=0;
    }
  }
}

for($i=3;$i<$max;$i++){
  $ch[$i]+=$ch[$i-1];
}

while(fscanf(STDIN,"%d",$n)){
  printf("%d\n",$ch[$n]);
}

C++: #include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>

using namespace std;

bool isPrimes[1000000];

int main()
{
	int res = 0;
	int n;
	scanf("%d", &n);
	for (int i = 0; i <= n; ++i)
		isPrimes[i] = true;
	isPrimes[0] = isPrimes[1] = false;
	for (int i = 2; i <= n; ++i)
	{
		if (isPrimes[i])
		{
			for (int j = i*2; j <= n; j += i)
				isPrimes[j] = false;
			++res;
		}
	}
	printf("%d\n", res);

	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>

using namespace std;
const int maxx = 2000000;
bool is_prime[maxx];
int prime[maxx];
int a,cnt = 0;
int main()
{
    memset(is_prime,true,sizeof is_prime);
    is_prime[0] = is_prime[1] = false;
    for(int i = 2; i * i < maxx; i ++ )
    {
        if(is_prime[i])
        {
            prime[cnt++]=i;
            for(int j = i*2;j < maxx; j+=i ) is_prime[j] = false;
        }
    }
    while(scanf("%d",&a)!=EOF)
    {
        int k = upper_bound(prime,prime+cnt,a) - prime;
        printf("%d\n",k);

    }

    return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

void sieve(int n, vector<int> &primes)
{
    vector<bool> v(n + 1, true);

    // check
    for (int i = 2, end = sqrt(n); i <= end; i++) {
        if (!v[i] || !(i & 1))
            continue;
        for (int j = i + i; j <= n; j += i)
            v[j] = false;
    }

    primes.push_back(2);
    for (int i = 3; i <= n; i += 2)
         if (v[i])
            primes.push_back(i);
}

int main()
{
    vector<int> primes;
    vector<int> inputs;
    int i;

    // read all inputs
    for (int x; cin >> x;)
        inputs.push_back(x);

    // init sieve
    sieve(*max_element(inputs.begin(), inputs.end()), primes);

    for (auto x : inputs) {
        for (i = 0; i < primes.size(); i++) // find
            if (primes[i] == x) {
                i++;
                break;
            } else if (primes[i] > x)
                break;
        cout << i << endl;
    }

    return 0;
}

C++: //TEMPLATE BEGIN
//#define ONLINE_JUDGE
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cctype>
#include <climits>
#include <cassert>
//#include <ctime>
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <numeric>
#include <functional>
#include <algorithm>
#include <complex>
#include <bitset>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
using namespace std;

#define FOR(i, a, b) for (int (i) = (a); (i) <= (b); ++ (i))
#define ROF(i, a, b) for (int (i) = (a); (i) >= (b); -- (i))
#define FOREDGE(i, u, head, next) for (int (i) = (head[(u)]); (i); (i) = (next[(i)]))
#define FORSTL(it, A) for (__typeof((A).begin()) it = (A).begin(); it != (A).end(); ++ it)
#define CLR(a, b) memset((a), (b), sizeof (a))
#define CPY(a, b) memcpy((a), (b), sizeof (a))
#define DEBUG cerr << "debug" << endl
#define STAR cerr << "**********" << endl

#define RT return
#define BK break
#define CT continue
#define ALL(x) (x).begin(), (x).end()
#define HEAP priority_queue
#define st first
#define nd second
#define pf push_front
#define pb push_back
#define ppf pop_front
#define ppb pop_back
#define mp make_pair
#define re real()
#define im imag()

#define LIST0(A, n) {						\
	FOR (i, 0, n - 1) printf("%d ", A[i]);	\
	printf("\n");							\
}											\

#define LIST1(A, n) {						\
	FOR (i, 1, n) printf("%d ", A[i]);		\
	printf("\n");							\
}											\

#define SHOW0(A, n, m) {					\
	FOR (i, 0, n - 1) {						\
		FOR (j, 0, m - 1)					\
			printf("%d ", A[i][j]);			\
		printf("\n");						\
	}										\
}											\

#define SHOW1(A, n, m) {					\
	FOR (i, 1, n) {							\
		FOR (j, 1, m)						\
			printf("%d ", A[i][j]);			\
		printf("\n");						\
	}										\
}											\

typedef long long LL;
typedef double DB;
typedef long double LDB;
typedef unsigned int UINT;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<DB> VB;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef map<int, int> MII;
typedef map<LL, LL> MLL;
typedef map<int, string> MIS;
typedef map<string, int> MSI;

const int INF(0x3f3f3f3f);
const LL LINF(0x3f3f3f3f3f3f3f3fLL);
const DB DINF(1e20);
const DB EPS(1e-12); //adjustable
const DB PI(acos(-1.0));

inline DB cot(DB x) { RT 1.0 / tan(x); }
inline DB sec(DB x) { RT 1.0 / cos(x); }
inline DB csc(DB x) { RT 1.0 / sin(x); }

template<class T> inline T max(T a, T b, T c) { RT max(max(a, b), c); }
template<class T> inline T max(T a, T b, T c, T d) { RT max(max(a, b), max(c, d)); }
template<class T> inline T min(T a, T b, T c) { RT min(min(a, b), c); }
template<class T> inline T min(T a, T b, T c, T d) { RT min(min(a, b), min(c, d)); }

template<class T> inline void Scan(T& x) { //int, LL
    char c;
    for (c = getchar(); c <= ' '; c = getchar()) ;
    bool ngt(c == '-');
    if (ngt) c = getchar();
    for (x = 0; c > ' '; c = getchar()) x = (x << 3) + (x << 1) + c - '0';
    if (ngt) x = -x;
}
template<class T> inline void Scan(T& x, T& y) { Scan(x), Scan(y); }
template<class T> inline void Scan(T& x, T& y, T& z) { Scan(x), Scan(y), Scan(z); }
//TEMPLATE END

int cntp, prime[100010];
bool vis[1000010];

void Init() {
	FOR (i, 2, 999999) {
		if (!vis[i]) prime[++ cntp] = i;
		for (int j = 1; j <= cntp; ++ j) {
			if (i * prime[j] >= 1000000) BK;
			vis[i * prime[j]] = true;
			if (!(i % prime[j])) BK;
		}
	}
	prime[++ cntp] = INF;
}

int n;

void Main() {
	Init();
	while (cin >> n) cout << upper_bound(prime + 1, prime + cntp + 1, n) - prime - 1 << endl;
}

int main() {
	Main();
    RT 0;
}
//imagasaikou!