def count_digits(n)
  Math.log10(n.abs).to_i + 1
end

N = gets.to_i
X = count_digits(N)

if X == 6
  puts 90909
elsif X == 5
  puts 909 + (n - 909)
elsif X == 4
  puts 909
elsif X == 3
  puts 9 + (N - 99)
elsif X == 2
  puts 9
else
  puts N
end
