n=gets.to_i
c=0
1.upto(n) do |i|
  if i/10==0 then c+=1
  elsif i/100==0 then next
  elsif i/1000==0 then c+=1
  elsif i/10000==0 then next
  elsif i/100000==0 then c+=1
  elsif i/1000000==0 then next
  elsif i==1000000 then c+=1
  end
end
puts c
