primes = Array.new(1000001, true)
primes[0], primes[1] = false, false

(2..Math.sqrt(1000001)).each do |i|
    if primes[i]
        (2 * i).step(1000001, i).each do |j|
            primes[j] = false
        end
    end
end

loop do
    n = gets.to_i
    puts primes.slice(0..n).count(true)
end