N = gets.chomp.to_i

arr = N.to_s.split('')

count = 0
l = arr.length
if l == 1
  count += N
end

if l > 1
  count += 9
end

if l == 3
  count += N - 99
end

if l > 3
  count += 900
end

if l == 5
  count += N - 9999
end

if l > 5
  count += 90000
end

print count
