n = gets.chomp.to_i
digits = n.to_s.chars.size
if digits == 1
  puts n
elsif digits.even?
  ans = (1..(digits-1)).step(2).inject(0) do |sum, i|
    sum += 9 * (10 ** ( i - 1 ))
  end
  puts ans
else
  ans = (1..(digits-2)).step(2).inject(0) do |sum, i|
    sum += 9 * (10 ** ( i - 1 ))
  end + n - 10**(digits-1) + 1
  puts ans
end
