program main
  implicit none

  integer                :: n, i, odd
  
  read *, n

  select case ( n )

  case (      1:9      )
     odd = 9
  case (     10:99     )
     odd = 9
  case (    100:999    )
     odd = 9 + n - 99
  case (   1000:9999   )
     odd = 9 + 990
  case (  10000:99999  )
     odd = 9 + 990 + n - 9999
  case ( 100000:999999 )
     odd = 9 + 900 + 90000
  end select

  print *, odd
  
end program main

