n = gets.to_i
count = 0
n.times do |i|
  if (i + 1) / 100000 >= 1 then
  elsif (i + 1) / 10000 >= 1 then
    count += 1
  elsif (i + 1) / 1000 >= 1 then
  elsif (i + 1) / 100 >= 1 then
    count += 1
  elsif (i + 1) / 10 >= 1 then
  elsif (i + 1) / 1 >= 1 then
    count += 1
  end
end

puts count
