n = gets.chop.to_i

def count_digit(num)
  num.to_s.length
end

l = count_digit(n)

s = 0

for t in 1...l do
  if t == 1
    s += 9
  elsif t % 2 == 1
    s += (10 ** t) - (10 ** (t - 1))
  end
end

if l % 2 == 1
  s += n - (10 ** (l-1)) + 1
end

puts s