require "prime"

def getprimenum x
	# counter = 0

	# (x + 1).upto(2 * x) {|i|
		# next if (i % 2 == 0 && i > 2 || i % 3 == 0 && i > 3 || i % 5 == 0 && i > 5)

		# counter += 1 if Prime.instance.prime?(i)
	# }

	# return counter

	return Prime.each(x * 2).to_a.length - Prime.each(x).to_a.length
end

loop {

	begin
		l = gets.chomp.to_i

		puts getprimenum(l) if l > 0
	rescue
		break
	end
}