#1行目
n = gets.chomp.to_i

unchi = 0

if n < 10 #1桁
  unchi = n
elsif n >= 10 and n < 100
  unchi = 9
elsif n >= 100 and n < 1000
  unchi = n - 99 + 9
elsif n >= 1000 and n < 10000
  unchi = 909
elsif n >= 10000 and n < 100000
  unchi = n -9999 + 909
else
  unchi = 90909
end

print unchi