n = gets.to_i

if n < 10 
    puts n # 1..n
elsif n < 100
    puts 9 # 1..9
elsif n < 1000
    puts n - 90 # 1..9, 100..n
elsif n < 10000
    puts 909 # 1..9, 100..999
elsif n < 100000
    puts n - 9090 # 1..9, 100..999, 10000..n
elsif n == 100000
    puts 90909 # 1..9, 100..999, 10000..99999
end
