Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func nextInt() int {
	i, e := strconv.Atoi(scanner.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func check(n int) int {
	eratos := make([]bool, n+1)
	cnt := 0
	for i := 2; i < len(eratos); i++ {
		if !eratos[i] {
			cnt++
			for j := i*i; j < len(eratos); j += i {
				eratos[j] = true
			}
		}
	}
	return cnt
}

func main() {
	for scanner.Scan() {
		n := nextInt()
		fmt.Println(check(n))
	}
}

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


int main()
{

	int i,n,count;
	deque<int> sosu;
	while(cin >> n){
		sosu.clear();
		if( n <= 2 ) {
			if( n == 2 ) {
				count = 1;
			}
			else 
				count = 0;
		}
		else {
			sosu.push_back(2);
			deque<int>::iterator it;
			bool flg;
			for( i = 3; i <= n ; i+=2 ) {
				flg = false;	
				for(it = sosu.begin(); it != sosu.end(); it++ ) {
					if( i < 2 * (*it) ){
						flg = true;
						break;
					}
					if( i % *it == 0 )
						break;
				}				
				if( flg == true ) {
					sosu.push_back( i );
				}
			}							
			count = sosu.size();
		}
		cout << count << endl;
	}
			
	return 0;
}

C++: #include <cstdio>
#include <vector>

int main(int argc, char *argv[]) {
	using namespace std;
	
	int line;
	while (EOF != fscanf(stdin, "%d", &line)) {
		vector<bool> sieve(line, true);
		int prmCount = 0;

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

	return 0;
}

C++: #include<stdio.h>
int main(void) {
   int n = 1000, i, l, s[1000];
   while ( n ) { s[n] = 0; n--; }
   s[1] = 1;
   for ( i = 2; i < 1000; i++ ) {
      if ( s[i] == 0 ) {
         for ( l = 2; l <= 1000 / i; l++ ) s[ i * l] = 1;
      }
   }
   for ( i = 1; i < 1000; i++ ) printf("s[%d]:%d\n", i, s[i]);
   return 0;
}

C++: #include<iostream>
#include<math.h>
using namespace std;
bool n[1000000]={0};
bool prime(int n){
	for(int i=2;i<=sqrt ((double)n);i++){
		if(n%i==0)return false;
	}
	return true;
}
int main(){
	for(int k=2;k<=999999;k++){
		if(prime(k))n[k]=true;
	}


	int a,sum=0;
	while(cin>>a){
	for(int j=2;j<=a;j++){
		if(n[j])sum++;
	}
	cout<<sum<<endl;
	sum=0;
	}
}

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

int main(){
	int n;
	int sosu[100000];
	int snum;
	bool judge;

	sosu[0] = 2;

	while(cin >> n){
		snum = 0;
		for(int i = 3; i <= n; i++){
			judge = true;
			for(int j = 0; j <= snum; j++){
				if(i%sosu[j] == 0){
					judge = false;
					break;
				}
			}
			if(judge == true){
				snum ++;
				sosu[snum] = i;
			}
		}
		cout << snum + 1 << endl;
	}



	return(0);
}

C++: #include <iostream>
#include <cmath>
using namespace std;
int prime(int);
int main(){
    int a,n;
    while ( cin >> a){
        n=0;
        for (int i=2;i<a;i++){
            if (prime(i)!=0){
                n++;
            }
        }
        cout << n << endl;
    }
}


int prime(int x){
    int y=0;
    if (x==1)
        return 1;
    for (int i=2;i<x/2+1;i++){
        if(x%i==0)
            return 0;
    }
    return x;
}

C++: #define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <vector>
#include <list>
#include <algorithm>

using namespace std;

int main(int argc, char const* argv[])
{
    vector<int> nl;
    int mx = 0;
    int n;
    while (scanf("%d ", &n) != EOF) {
        nl.push_back(n);
        mx = max(mx, n);
    }

    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);
        printf("%d\n", p - primes.begin());
    }

    return 0;
}

C++: #include<stdio.h>
#include<float.h>
#include<vector>


vector<int> primes;
int ref_max=2;

int makePrimenumbers(int a){
	if(a<ref_max)return 0;

	temp = ref_max;
	ref_max=a;
	int i,k,isp=1;

	for(k=temp;k<ref_max;k++){
		for(i=0;i<primes.size();i++){
			if(k%primes[i]==0){
				isp=0;
				break;
			}
		}
		if(isp==1){
			primes.push_back(k);
		}
		isp=1;
	}
	return 0;
}

int countprime(int a){
	int i;
	for(i=0;i<prime.size();i++)
		if(a<prime[i])
			break;
	return (i);
}

int main(void)
{
	int result;
	while(scanf("%d",&a)!=EOF){
		makePrimenumbers(a);
		result = countprime(a);
		printf("%d\n",result);
	}
  return 0;
}

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

int main()
{
	int count=0,n;
	bitset<1000001> prime;

	prime[0]=1;
	prime[1]=1;
	for(int i=2;i<=1000;i++)
		if(prime[i]==0)
			for(int j=i+1;j<=1000000;j++)
				if(j%i==0)
					prime[j]=1;
	
	while(cin>>n)
	{
		for(int i=0;i<=n;i++)
			if(prime[i]==0)
				count++;
		cout<<count<<endl;
	}
		
}

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

using namespace std;

bool isprime(int n)
{
	for (int i = 2; i <= sqrt(n); i++)
	{
		if (n % i == 0) return false;
	}

	return true;
}

int main()
{
	int N;

	int C = 0;

	cin >> N;

	for (int i = 2; i <= N; i++)
	{
		if (isprime(i) == true)
		{
			C += 1;
		}
	}

	cout << C << endl;

	return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
    int t[999999];

    return 0;
}

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

int main(void) {
	vector<int> v;
	v.push_back(2);
	v.push_back(3);
	int i, j;
	bool flag;
	for (i = 5; i < 999999; i++) {
		flag = true;
		for (j = 2; j <= sqrt(i); j++) {
			if (i % j == 0) {
				flag = false;
				break;
			}
		}
		if (flag) {
			v.push_back(i);
		}
	}
	int n;
	while (cin >> n) {
		i = distance(v.begin(), lower_bound(v.begin(), v.end(), n));
		if (v[i] == n)
			cout << i + 1 << endl;
		else 
			cout << i << endl;
	}

}

C++: #include<iostream>
#include<vector>
using namespace std;
int main(){
	int time;
	vector<int> v;
	v.push_back(2);
	v.push_back(3);
	while(cin>>time){
		int abcd=0;
		if(time>v[v.size()-1]){
			for(int abc=1+v[v.size()-1];abc<=time;abc+=2){
				for(int bcd=0;bcd<(int)v.size() ;bcd++){
					if(abc%v[bcd]==0){
						goto end;
					}
				}
				v.push_back(abc);
				end:;
			}
		}
		for(int abc=0;v[abc]<=time;abc++){
			abcd++;
		}
		cout<<abcd<<endl;
	}
	return 0;
}

C++: //#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#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++)
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1<<30;
using P=pair<int,int>;
vector<int> dx={0,1,-1,0};
vector<int> dy={1,0,0,-1};

vector<int> prime(0);//i番目の素数
vector<bool> is_prime(0);//iは素数か
//n以下の素数の数
int hurui(int n){
    is_prime.resize(n+1,true);
    is_prime[0]=0; is_prime[1]=0;
    int p=0;
    REP(i,2,n+1){
        if(is_prime[i]){
            prime.emplace_back(i);
            p ++;
            for(int j=2*i; j<=n; j +=i){
                is_prime[j]=false;
            }
        }
    }
    return p;
}


int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cout << fixed << setprecision(10);
  hurui(1e7);
  int n;
  while(cin>>n){
      cout<<upper_bound(all(prime),n)-prime.begin()<<endl;
  }
}