N = gets.chomp.to_i
a = 0
if N < 10
    puts N
elsif N < 100
    puts 9
elsif N < 1000
    a = 9 + (N-99)
    puts a
elsif N < 10000
    puts 909
elsif N < 100000
    a = 909 + (N-9999)
    puts a
else
    puts 90909
end