n = gets.to_i

if n <= 9
  res = n
elsif 10 <= n && n <= 99
  res = 9
elsif 100 <= n && n <= 999
  res = (n - 99) + 9
elsif 1000 <= n && n <= 9999
  res = 9 + 900
elsif 10000 <= n && n <= 99999
  res = 9 + 900 + (n - 10000)
else
  res = 9 + 900 + 90000
end

puts res