n = gets.chomp

digit_count = n.size

res = 0
(1..digit_count).each do |i|
  i.even? && next

  if i == 1
    if digit_count > 1
      res += 9
    else
      res += digit_count
    end
    next
  end

  if i == digit_count
    x = '1'
    (1..i-1).each { x += '0' }
    res += n.to_i - x.to_i + 1
    next
  end

  res += 10**(i - 1) * 9
end

puts res