counts = [0, 9, 0, 900, 0, 90000]

n_str = gets.chomp
digits = n_str.size

if digits % 2 == 0
    puts counts[0..digits].inject(:+)
else
    n = n_str.to_i
    puts counts[0..(digits - 1)].inject(:+) + n - 10 ** (digits - 1) + 1
end
