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++: /*
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)
	{
		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<string>
#include<cmath>
using namespace std;

int main()
{
	
	long long int k,p[100000];
	long long int n;
	p[0]=2;
	cin>>n;
	k=0;
	int r=(int)sqrt((float)n);
	for(int i=3;i<=r;i++){
		for(int j=0;j<k+1;j++){
			if(i%p[j]==0){
				break;
			}else if(j==k){
				k++;
				p[k]=i;
			}
		}
	}
	long long int r_k=k;
	for(;r<n;r++){
		for(long int i=0;i<=r_k;i++){
			if(r%p[i]==0){
				break;
			}else if(i==r_k){
				k++;
			}
		}
	}
	if(k!=0&&k!=1){
		k+=1;
		cout<<k<<endl;
	}else{
		cout<<k<<endl;
	}
	cin.sync();
	cin.get();
}

C++: #include <bits/stdc++.h>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)

#define INF 100000000
#define MOD 1000000007
#define writeln(n) cout<<n<<endl
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
//vector<tuple<long long, long long, long long>>vec;

template<class T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

int dy[] = {0, 0, 1, -1, 0};
int dx[] = {1, -1, 0, 0, 0};

const int inf=100000000;

bool isprime(int p) {
    if (p == 1) return false;
    for (int i = 2; i < p; i++) {
        if (p%i == 0) return false;
    }
    return true;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n; cin>>n;
    int cnt=0;
    for(int i=1; i<=n; i++)
    {
        if(isprime(i)) ++cnt;
    }
    cout<<cnt<<endl;
}

C++: #define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <vector>
#include <list>
#include <algorithm>

using namespace std;

int main(int argc, char const* argv[])
{
    //ios::sync_with_stdio(false);
    //cin.tie(0);

    vector<int> nl;
    int mx = 0;
    do{
        int n;
        cin >> n;
        if (!cin.eof()){
            nl.push_back(n);
            mx = max(mx, n);
        }else{
            break;
        }
    }while(1);

    double r = sqrt(mx);

    list<int> sl;
    vector<int> primes;

    for (int i = 2; i <= mx; i++) {
        sl.push_back(i);
    }

    while (sl.front() <= r) {
        int p = sl.front();
        primes.push_back(p);
        sl.pop_front();

        auto i = sl.begin();
        while(i != sl.end()){
            if(*i % p == 0){
                i = sl.erase(i);
            }
            else {
                i++;
            }
        }
    }

    for (auto&& i : sl) {
        primes.push_back(i);
    }

    for (auto&& n : nl) {
        auto p = upper_bound(primes.begin(), primes.end(), n);
        cout << p - primes.begin() << endl;
    }

    return 0;
}

C++: #include <stdio.h>
int main(void){
	int k,j,a;
	char flag[1000000]={1,1};//0,1は除外する
	for(k=2;k<1000;k++){
		if(flag[k]==0){
			for(j=k*k;j<1000000;j+=k)
				flag[j]=1;
		}
	}
	while(~scanf("%d",&a)){
		k=0;
		for(j=0;j<a;j++) if(flag[j]==0) k++;
		printf("%d\n",k);
	}
}

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

int main()
{
	int n[30];
	int i=0;
	while(cin >> n[i]) {i++;}
		
	for (int k=0;k=i;k++){
		int s=1;
		for (int j=3;j<=n[k];j++){
			for(int m=2;m<j;m++){
				if(j%m==0){break;}
				if(m==j-1){s=s+1;}
			}
		}
		cout << s << endl;
	}	
    return 0;
}

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

int main(){
  bool is_prime[1000000];

  is_prime[0] = is_prime[1] = false;
  for(int i=2; i<1000000; i++){
    is_prime[i] = true;
  }

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

  int n_prime[1000000];

  int cnt = 0;
  for(int i=0; i<1000000; i++){
    if(is_prime[i]){
      cnt++;
    }

    n_prime[i] = cnt;
  }

  while(true){
    int n;
    cin >> n;

    if(cin.eof())
      break;

    cout << n_prime[n] << endl;
  }

  return 0;
}

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

using namespace std;


int main(int argc, const char * argv[]) {
    // insert code here...
    
    int maxNumber;
    int countPrime=0;
    bool judgePrime = true;
    
    cin >> maxNumber;
    
    for(int i=2; i<=maxNumber;i++){
        for(int j=2; j<i;j++){
            if(i%j==0){
                judgePrime = false;
            }
        }
        if(judgePrime){countPrime++;}
        judgePrime = true;
    }
    cout << countPrime;
    
    return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
bool prime(int n)
{
    for(int i=2;i<=sqrt(n);i++)
    {
        if(n%i==0)
            return false;
    }
    return true;
}
int main()
{
    int c,i,p=0;
    int in[30],out[30];
    while(scanf("%d",&in[p])!=EOF)
    {
        c=0;
        for(i=2;i<=in[p];i++)
        {
            if(prime(i))
                c++;
        }
        out[p] = c;
        p++;
    }
    for(i=0;i<p;i++)
        cout<<out[i]<<endl;
    return 0;
}

C++: #include<iostream>
using namespace std;
int main() {
	int a;
	int sum;
	while (cin >> a){
		sum = 0;
		for (int i = 0; i < a; i++){
			int y = 0;
			int l = i + 1;
			for (int i = 1; i != l+1; i++){
				if (l % i == 0) {
					y++;
				}
			}
			if (y == 2)sum++;
		}
		cout << sum << endl;
	}
}