max = 1_000_000
table = Array.new(max, true)
2.upto(max - 1){|i|
    count = 2
    until i * count >= max
        table[i * count] = false
        count += 1
    end
}
n_primes = Array.new(max, 0)
count = 0
2.upto(max - 1){|i|
    count += 1 if table[i]
    n_primes[i] = count
}

while n = gets
    n = n.to_i
    puts n_primes[n]
end