require 'prime'
m = Array.new(1000000,0)
max = 1
while n = gets.to_i do
    if m[n] > 0
        puts m[n]
        next
    end
    for i in max..n
        m[i] = m[i-1] + (Prime.prime?(i) ? 1 : 0)
    end
    max = n
    puts m[n]
end