def eratosthenes(n)
    primes = Array.new(n + 1, true)
    primes[0], primes[1] = false, false

    (2..Math.sqrt(n)).each do |i|
        if primes[i]
            (2 * i).step(n, i).each do |j|
                primes[j] = false
            end
        end
    end
    return (2..n).count {|i| primes[i]}
end

loop do
    n = gets.to_i
    puts eratosthenes(n)
end