def prime_list num
  return (2..num).to_a.inject([]) do |result, i|
    # divide check
    if result.inject(true) { |n, j| n && (i%j != 0) }
      result << i
    end
    result
  end
end

while line = gets do
  puts prime_list(line.to_i).length
end