import std.stdio;
import std.string;
import std.conv;

void main(){
	auto numarray = new ulong[1000000];
	foreach(i, ref elem; numarray){
		elem = 2 * i + 1;
	}

	for(auto i = 1; i < numarray.length; i++){	
		auto p = numarray[i];	
		if(p == 0) continue;

		for(auto j = 1; i + p * j < numarray.length; j++){
			numarray[cast(size_t)(i + p * j)] = 0;
		}
	}

	auto parray = new ulong[numarray.length / 2];
	uint j;
	foreach(elem; numarray){
		if(elem != 0){
			parray[j] = elem;
			j++;
		}
	}
	
	string str;
	while((str = readln()).length != 0){
		auto inputnum = to!ulong(chomp(str));

		foreach(i, elem; parray){
			if(inputnum < elem){
				writeln(i);
				break;
			}
		}
	}
}