n = gets.to_i
ans =
  case n
  when 1..9
    n
  when 10..99
    9
  when 100..999
    9 + (n - 99)
  when 1000..9999
    9 + 900
  when 10000..99999
    9 + 900 + (n - 9999)
  when 100000
    9 + 900 + 90000
  end

puts ans
