Go: package main

import (
        "fmt"
)

const MAX int = 1000000
var primes [MAX]int

func main() {
        Init()
        var n, cnt int
        for {
                _, err := fmt.Scanf("%d", &n)
                if err != nil {
                        break
                }
                cnt = 0
                for i := 2; i <= n; i++ {
                        cnt += primes[i]
                }
                fmt.Printf("%d\n", cnt)
        }
}

func Init() {
        for i := 0; i < MAX; i++ {
                primes[i] = i
        }

        Soe()

        for i := 0; i < MAX; i++ {
                primes[i] %= 2
        }
        primes[1] = 0
        primes[2] = 1
}

func Soe() {
        for i := 2; i < MAX; i++ {
                if primes[i] > 0 {
                        for j := 2; j < MAX/i; j++ {
                                if i * j < MAX {
                                        primes[i*j] = 0
                                }
                        }
                }
        }
}

C++: #include <iostream>
using namespace std;
typedef long long int LL;
#define MOD 1000000007

LL pow(LL m, LL n)
{
	LL res = 1,x = 1,a = m;
	while (x <= n) {
		if ((x & n) > 0) {
			res *= a;
			res %= MOD;
		}
		a *= a;
		a %= MOD;
		x <<= 1;
	}
	res %= MOD;
	return res;
}

int main()
{
	LL m, n;
	cin >> m >> n;
	cout << pow(m,n) << endl;
	return 0;
}

C++: #include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=2*asin(1);


int main() {
  bool prime[1000005];
  int primenum[1000005];
  for(int i=0;i<1000005;++i) prime[i] = true;
  prime[0] = false;
  prime[1] = false;
  for(int i=2;i<1000005;++i){
    if(prime[i]==false) continue;
    for(int j=2;i*j<1000005;++j){
      prime[i*j] = false;
    }
  }
  primenum[0] = 0;
  primenum[1] = 0;
  for(int i=2;i<1000005;++i){
    if(prime[i]){
      primenum[i] = primenum[i-1] + 1;
    }
    else{
      primenum[i] = primenum[i-1];
    }
  }
  int N;
  while(cin>>N){
    cout<<primenum[N]<<endl;
  }
}

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

int main() {
    while(cin) {
        int n;
        cin >> n;
        
        int count = 0;
        for(int i=1; i<=n; i++) {
            int k = 0;
            for(int j=1; j<=i; j++) {
                if(i%j == 0) k++;
            }
            if(k == 2) {
                count ++;
            }
        }
        cout << count << endl;
    }
    return 0;
}

C++: #include <stdio.h>

#define MAX (1000000)

bool primeTbl[MAX];

int main() {
	
	primeTbl[0] = primeTbl[1] = true;
	for(int i=2; i<MAX; i++) {
		if(!primeTbl[i])
			for(int j=i*2; j<MAX; j+=i)
				primeTbl[j] = true;
	}

	int n;
	while(scanf(" %d", &n)) {
		int ans = 0;
		for(int i=2; i<=n; i++)
			if(!primeTbl[i])
				ans++;
		printf("%d\n", ans);
	}
	return 0;
}

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

bool IsPrimeNumber(int number) {
	if (number < 2) return false;
	if (number == 2) return true;
	if (number % 2 == 0) return false;
	int max = (int)std::sqrt(number);
	for (int i=3; i<=max; i+=2)
		if (number % i == 0)
			return false;
	return true;
}

int main() {
	int N[1000000] = {0};
	for (int i=1; i<=999999; i++) {
		if (IsPrimeNumber(i)) {
			N[i] = N[i-1] + 1;
		} else {
			N[i] = N[i-1];
		}
	}
	int n;
	while (std::cin >> n) {
		std::cout << N[n] << std::endl;
	}
	return 0;
}

C++: #include<iostream>
#define N 999999
#define FOR(i,a,b) for( int i = ( a ); i < ( b ); i++ )
#define WHILE(n) while( std::cin >> n )
int p[(N+1)/2];int m[N+1];int mk();using namespace std;int main(){int n;p[0]=2;m[1]=0;m[2]=1;mk();WHILE(n){cout<<m[n]<<'\n';}return 0;}int mk(){int i,j,e=1;FOR(i,3,N){for(j=0;p[j]*p[j]<=i;j++){if(i%p[j]==0){goto tag;}}p[e]=i;e++;tag:m[i]=e;}}

C++: #include <cstdio>
#include <queue>
#include <string>
#include <set>
#include <map>
#include <vector>
#include <string>
#include <sstream>
#include <iostream>
#include <bitset>
#include <cmath>
#include <algorithm>
#include <functional>
#include <string.h>
using namespace std;
const int INF = 1 << 28;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i,start,end) for(int i=(start);i<(end);++i)
#define pint(i) printf("%d\n",(i))
#define pint2(i,j) printf("%d %d",(i),(j))
#define pint3(i,j,k) printf("%d %d %d",(i),(j),(k))
#define pll(i) printf("%lld\n",(i))
#define pll2(i,j) printf("%lld %lld",(i),(j))
#define pll3(i,j,k) printf("%lld %lld %lld",(i),(j),(k))
#define gint(i) scanf("%d",&(i))
#define gint2(i,j) scanf("%d %d",&(i),&(j))
#define gint3(i,j,k) scanf("%d %d %d",&(i),&(j),&(k))
#define gll(i) scanf("%lld",&(i))
#define gll2(i,j) scanf("%lld %lld",&(i),&(j))
#define gll3(i,j,k) scanf("%lld %lld %lld",&(i),&(j),&(k))
#define init(tar,val) memset((tar),(val),sizeof((tar)))
#define show(tar,len) for(int i=0;i<(len);++i) \
	cout<<tar[i]<<' ';\
	cout<<endl;



/*
class bignum{
public:
bignum(int size = 4):len(size){
}
~bignum(){
}
int size()const{
return len;
}
//int get(int id)const{
//	return num[id];
//}
friend ostream &operator<<(ostream &output, const bignum &b){
bool stu = false;
for (int i = int(b.len - 1); i >= 0; --i){
if (stu)
printf("%09d", b.num[i]);
else if (b.num[i] > 0){
printf("%d", b.num[i]);
stu = true;
}
}
if (stu == false)
printf("0");
return output;
}
const bignum& operator+=(const bignum&right){
int add = 0;
for (int i = 0; i < len; ++i){
int tmp = 0;
if (i < right.size()){
tmp = right.num[i] + num[i] + add;
}
else{
tmp = num[i] + add;
}
num[i] = tmp%gap;
add = tmp / gap;
}
return *this;
}
const bignum& operator=(const bignum&right){
for (int i = 0; i <len; ++i){
num[i] = right.num[i];
}
return *this;
}
void set(int a){
for (int i = 0; i <len; ++i){
num[i] = a%gap;
a /= gap;
}
}
private:
int  num[4];
int len;
static const int gap =1000000000;
};

//int gcd(int a,int b){
//	if(b==0)
//		return a;
//	return gcd(b,a%b);
//}
//
////a*x+b*y=gcd(a,b);
//int extgcd(int a,int b,int &x,int &y){
//	int d=a;
//	if(b!=0){
//		d=extgcd(b,a%b,y,x);
//		y-=(a/b)*x;
//	}
//	else{
//		x=1,y=0;
//	}
//	return d;
//}


//inline int id(int i){
//	return i & 1;
//}
//
//inline int last(int i){
//	return (i - 1) & 1;
//}
//
//void myshow(int i){
//	rep(j, 0, ){
//		cout << dp[id(i)][j] << ' ';
//	}
//	cout << endl;
//}

//int n_stu[MAX_N];
//void n_init(){
//	rep(i, 0, n)
//		n_stu[i] = i;
//}
//int n_getf(int id){
//	if (n_stu[id] != id){
//		n_stu[id] = n_getf(n_stu[id]);
//	}
//	return n_stu[id];
//}
//bool n_same(int i, int j){
//	if (n_getf(i) == n_getf(j))
//		return true;
//	return false;
//}
//void n_union(int i, int j){
//	int fi = n_getf(i), fj = n_getf(j);
//	if (fi != fj){
//		n_stu[fi] = fj;
//	}
//}

*/

//#define my_debug



int n;
const int len = 1000005;
bool stu[len];
void setup(){
	init(stu, 1);
	stu[0] = stu[1] = false;
	rep(i, 2, len){
		if (stu[i]){
			int j = i +i;
			while (j < len){
				stu[j] = false;
				j += i;
			}
		}
	}
}
void solve(){
	int out = 0;
	rep(i, 0, n+1){
		if (stu[i])
			++out;
	}
	pint(out);
}

int main(){
#ifdef my_debug
	freopen("a.in", "r", stdin);
#endif
	setup();
	while (gint(n) != EOF){

		solve();
	}
	return 0;
}