$primes = [2,3]

def is_prime?(n)
	i = 0
	while $primes[i] <= Math.sqrt(n).to_i
		return false if n % $primes[i] == 0
		i += 1
	end
	return true
end

def next_prime(n)
	n += 1 if n % 2 == 0
	loop do
		return n if is_prime?(n)
		n += 2
	end
end

def make_prime(n)
	while $primes[-1] <= n
		$primes << next_prime($primes[-1]+1)
	end
end

while gets
	n = $_.to_i
	if n < 0 || 1000000 < n
		puts "n must be in the range (1..999999)"
		next
	end
	make_prime(n)
	puts $primes[0,$primes.index{|x| x>n}].size
end