STDIN.read.split("\n").map { |i| i.chomp.to_i }.each do |max|
  table = Array.new(max + 1, true)
  prime_list = []
  (2..max).each do |num|
    prime_list << num if table[num] == true
    k = num * num
    while k <= max
      table[k] = false
      k += num
    end
  end

  prime_list.count
end