N = gets.to_i
answer = 0

if 1 <= N && N < 10 then
    answer = N  
elsif 10 <= N && N < 10**2 then
    answer = 9
elsif 100 <= N && N < 10**3 then
    answer = 9 + (N - 100 + 1)
elsif 10**3 <= N && N < 10**4 then
    answer = 9 + 900
elsif 10**4 <= N && N < 10**5 then
    answer = 9 + 900 + (N - 10000 + 1)
elsif N == 10**5 then
    answer = 9 + 900 + 90000
end

puts answer