n = gets.to_i
count = 0
case n
when 1..9
  count = n
when 10..99
  count = 9
when 100..999
  count = n - 90
when 1000..9999
  count = 909
when 10000..99999
  count = n - 90 - 9000
when 100000
  count = 90909
end
puts count
