def nonprime?(i)
  (2..i**0.5).any?{|j| i % j == 0}
end

prime_list = Array.new(1E6){|i| if nonprime?(i) then 0 else 1 end}
prime_list[0..2] = [0, 0, 1]

while n = gets
  n = n.to_i
  puts prime_list.first(n+1).inject(:+)
end