def era(n)
    $primes = Array.new(n, true)
    $primes[0], $primes[1] = false, false
    (2..Math.sqrt(n)).each do |i|
        if $primes[i]
            (i * i).step(n, i).each do |j|
                $primes[j] = false
            end
        end
    end
end

era(1000000)

while n = gets.to_i
    puts $primes.slice(0..n).count(true)
end