r = Array.new 1000000,1
(2..1000).each{|i|
	next if r[i] == 0
	j = i * i
	while j < 1000000
		r[j] = 0
		j += i
	end
}
r[0] = r[1] = 0
(2..1000000).each{|i|
	r[i] = r[i] == 1 ? r[i-1] + 1 : r[i - 1]
}
while gets
	p r[$_.to_i]
end