Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	for sc.Scan() {
		input := nextInt()
		fmt.Println(IsPrime(input))
	}
}

func IsPrime(num int) int {
	eratos := make([]bool, num+1)
	c := 0
	for i := 2; i < len(eratos); i++ {
		if eratos[i] == false {
			c++
			eratosCalc(i, eratos)
		}
	}
	return c
}

func eratosCalc(primeNum int, eratos []bool) {
	for i := primeNum * primeNum; i < len(eratos); i += primeNum {
		eratos[i] = true
	}
}

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

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

C++: /*
C++ ???????????????????????????????????¬??????
??????AOJ-ITP1??????????????????
*/
#define _USE_MATH_DEFINES

#include <iostream> // ?¨??????\??????
#include <fstream>  // ??????????????\??????
#include <string>   // ???????????¢???
#include <vector>   // ???????????????
#include <cmath>    // ??°??????
#include <iomanip>  // stream???????????¢???
#include <algorithm>// max??¢??°??????

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;        // ????´???°????????????????????????
using std::fixed;         // ???????????????????¨???????????????????????????????
using std::setprecision;  // ?????°????°???°?????\???????????°????????????????????¨????????\???

int main() {
	int a;
	int count;
	int ccount;
	vector<int> c = { 0 };
	while (cin >> a)
	{
		a = a + 1;
		count = 0;
		/*
		// ?´???°?????????
		// ??????????????°
		for (size_t i = 2; i < a; i++)
		{
			ccount = 0;
			// ????????°
			for (size_t j = 1; j <= i; j++)
			{
				//cout << "i= " << i << "j= " << j << endl;
				if (i % j == 0) {
					ccount++;
				}
			}
			if (ccount > 2) {
				count++;
			}
		}*/
		// ?????§????????§????????????0??§???????????????
		c.resize(a);

		
		// 2*i????????§????????§?????????????????????1?????????
		for (size_t i = 2; i < a; i++)
		{
			for (size_t j = 2; i*j < a; j++)
			{
				//cout << i*j << endl;
				c[i*j] = 1;
			}
		}
		// ??????????????????0??????????????°????????????
		for (size_t i = 0; i < a; i++)
		{
			if (c[i] == 0) {
				count++;
			}
		}
		cout << count-2 << endl;

		// ?¢??????¨
		
		for (size_t i = 0; i < a; i++)
		{
			cout << i << " = " << c[i] << endl;
		}
		
	}
	return 0;
}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>

using namespace std;


#define all(c) ((c).begin()), ((c).end())
#define debug(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, a, b) for (int i = (int)(a); i <= (int)(b); i++)

#define mp make_pair
#define fst first
#define snd second
#define pb push_back


const double EPS = 1e-10;


typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef complex<double> P;



int main(){
	int n; cin >> n;
	vi p(n + 1, 1);
	p[0] = p[1] = 0;
	int ans = 0;
	rep(i, n + 1) if (p[i]) {
		ans++;
		for (int j = i + i; j <= n; j += i) p[j] = 0;
	}
	cout << ans<< endl;
	return 0;
}

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

int main(){
    int n;
    while(cin>>n){
        if(n == 1) {
            cout<<0<<endl;
        }
        else if(n == 2){
            cout<<1<<endl;
        }
        else{
            int num[1000000] = {};
            for(int tmp = 2;tmp != n;tmp++){
                if(num[tmp] == 0)
                for(int i = tmp * 2;i <= n;i += i){
                    num[i] = 1;
                }
            }
            int count = 0;
            for(int i = 2;i != n;i++){
                if(num[i] == 0){
                    count++;
                }
            }
            cout<<count<<endl;
        }
    }
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cctype>
#define rep(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;

int main(){
  int n,ans[1000000]={0};
  bool num[1000000]={true};
  num[1]=true;
  for(int i=2;i<1000000;i++){
    if(num[i]==false){
      for(int j=i+i;j<1000000;j=j+i){
	num[j]=true;
      }
    }
  }

  for(int i=1;i<1000000;i++){
    ans[i]=ans[i-1]+!num[i];
    //cout<<num[i]<<endl;
  }
  while(cin>>n){
    cout<<ans[n]<<endl;
  }
  
  return 0;
}

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

bool isChecked[1000010];
vector <int> prime;

int main() {
	for (int i = 0;i < 1000000; i++) isChecked[i] = false;
	isChecked[0] = true;
	isChecked[1] = true;
	for (int i = 2; i < 1000000;i++) {
		if(isChecked[i]) continue;
		prime.push_back(i);
		for (int j = 1; j * i < 1000000;j++) {
			isChecked[j*i] = true;
		}
	}
	int n;
	while(cin >> n) {
		int i;
		for(i = 0;;i++) {
			if (prime[i] > n) break;
		}
		cout << i << endl;
	}
	return 0;
}

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

int main()
{
	vector<int> pcount;
	int prime[10000];
	int j, k, x, num,count=0;
	while (cin >> num){
		prime[0] += 2;
		x = 1;
		k = 1;
		while (prime[k-1] <= num)
		{
			x += 2;
			j = 0;
			while (j < k && x % prime[j] != 0)j++;
			if (j == k)
			{
				prime[k++];
				count++;
			}
		}
		pcount.push_back(count);
		count = 0;
	}
	for (int i = 0; i < pcount.size(); i++)
	{
		cout << pcount[i] << endl;
	}
	return 0;
}

C++: #include<stdio.h>
#include<math.h>
int main(){
	int a[999999]={0},i,j;
	a[1]=1;
	for(i=2;i<=999999;i++){
		if(a[i]==0)for(int j=i*2;j<=999999;j+=i)a[j]=1;}
	int n;
	while(~scanf("%d",&n)){
		int sum=0;
		for(i=1;i<=n;i++){
			if(a[i]==0)sum++;}
		printf("%d\n",sum);}
	return 0;}

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

const int N = 1000010;

bool prime[N];
int number[N];
void init() {
  for (int i=0;i<N;i++) prime[i] = true;
  prime[0] = prime[1] = false;
  for (int i=0;i<=sqrt(N);i++) {
    if (prime[i]) {
      for (int j=i*2;j<N;j+=i) prime[j] = false;
    }
  }
  number[0] = 0;
  for (int i=0;i<N-1;i++) {
    number[i + 1] = number[i] + prime[i + 1];
  }
}

int main() {
  int n;
  init();
  while (cin >> n) {
    cout << number[n] << endl;
  }
}

C++: #include <stdio.h>

int main(void)
{
	int n;
	scanf("%d", &n);
	
	bool *d = new bool [n+1];
	int count = 0;

	for(int i = 0; i <= n; i++)
		d[i] = true;

	for(int i = 2; i <= n; i++){
		if(d[i]){
			count++;
			for(int j = i*2; j <= n; j+=i)
				d[j] = false;
		}
	}
	printf("%d\n", count);



	return 0;
}

C++: #include <iostream>
#include <string>
#include <stack>
#include <math.h>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <vector>

using namespace std;
int sieve(int n);
int prime[1000000];
bool is_prime[1000000];

int main()
{

	int p = 0;
	for (int i = 0; i <= 999999; i++) {
		is_prime[i] = true;
	}
	is_prime[0] = is_prime[1] = false;
	for (int i = 2; i <= 999999; i++) {
		if (is_prime[i]) {
			prime[p++] = i;
			for (int j = 2 * i; j <= 999999; j += i) {
				is_prime[j] = false;
			}
		}
	}
	int n;
	while (cin>>n) {
		int i = 0;
		while (prime[i] <= n) {
			i++;
		}
		cout << i << endl;
	}
}

C++: #include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main(){
  int n;
  int cont;
  while(scanf("%d",&n)!=EOF){
    int a[1000000]={0};
    int cont=0;
    a[1]=1;
    for(int i=2;i<=sqrt(n);i++){
      if(a[i]==0){
      for(int j=2;j<=n;j++){
	a[i*j]=1;
      }
    }
    }
    for(int i=1;i<=n;i++){
      if(a[i]==0)cont++;
    }
    cout<<cont<<endl;
  }
}

C++: #include <iostream>
#include <cmath>

using namespace std;

int main(){
}