N = gets.chomp.to_i
digit = N.to_s.length

output = 0

case digit
when 1
  output = N
when 2
  output = 9
when 3
  output = 9 + (N - 99)
when 4
  output = 9 + 900
when 5
  output = 9 + 900 + (N - 9999)
when 6
  output = 9 + 900 + 90000
end

puts output
