program main
  implicit none

  integer n, kt

  read(*,*)n
  kt = int(log(real(n)))
  
  if (kt == 0) then
    write(*,*)n
    stop
  else if (kt == 1) then
    write(*,*)9
    stop
  else if (kt == 2) then
    write(*,*)9 + n - 100 + 1
    stop
  else if (kt == 3) then
    write(*,*)909
    stop
  else if (kt == 4) then
    write(*,*)909 + n - 1000 + 1
    stop
  else
    write(*,*)90909
  end if
end program main
