prime = Array.new(10 ** 6,true)
for i in 2..10 ** 3
  if prime[i]
    for j in 2..10 ** 6 / i
      prime[i * j] = false
    end
  end
end
while n = gets
  puts prime[2..n.to_i].select{|i|i}.size
end

