#include<iostream>
#include<cmath>
using namespace std;

int main(){

	int n, i, j, prmnum;
	bool prm = true;
	double sqrootm,sqrootp;

	while(cin>>n){
		if(n==0)prmnum=0;
		else if(n==1)prmnum=0;
		else if(n==2)prmnum=1;
		else{

			prmnum = 2;

			for( i=6; i<=n+1; i+=6 ){
				prm = true;

				sqrootm = sqrt((double)(i-1));
				sqrootp = sqrt((double)(i+1));

				for( j=3;j<=sqrootm;j+=2 ){
					if( (i-1)%j == 0 ){
						prm = false;
						break;
					}
				}
				if(prm)prmnum++;

				prm = true;

				if( i!=n+1 ){
					for( j=3;j<=sqrootp;j+=2 ){
						if( (i+1)%j == 0 ){
							prm = false;
							break;
						}
					}
				}
				if(prm)prmnum++;
			}
		}






		cout << prmnum << endl;


	}
	return 0;
}