while line = gets
  def erato(n)
    numbers = (0..n).to_a
    numbers[0], numbers[1] = nil
    m = []
    for d in numbers
      next unless(d)
      break if (Math::sqrt(n) < d)
      (2*d..n).step(d){|e| numbers[e] = nil}
      (2*d..n).step(d){|e| m << e}
    end
    numbers.delete(nil)
    s = numbers.size
    return s
  end
  p erato(line.to_i)
end