# Wikipedia: https://goo.gl/0yPNFL
# ??¨????????????????????????

def prime_number_list(n)
  max_num = Math.sqrt(n)

  arr = (2..n).to_a
  2.upto(max_num) do |i|
    arr = Array(i) + arr[0..-1].reject { |num| num % i == 0 }
  end
  arr
end

while n = gets.to_i
  break if n == 0
  puts prime_number_list(n).count
end