program main
  implicit none
  integer :: n, o

  read *, n 
  if (n < 10) then
    o = n
  else if (n < 100) then
    o = 9
  else if (n < 1000) then
    o = n - 99 + 9
  else if (n < 10000) then
    o = 909
  else if (n < 100000) then
    o = n - 9999 + 909
  else
    o = 90909
  end if
  print '(i0)', o

end program
