def main
  n = gets.chomp.to_i
  digits = n.to_s.length
  sum = 0
  sum += (n - (10**(digits-1)) + 1) if digits % 2 == 1
  d = digits - 1
  while d > 0 do
    if d % 2 == 0
      d -= 1
      next
    end
    sum += (10**d - 10**(d-1))
    d -= 1
  end
  puts sum
end

main if $0 == __FILE__