program main
  implicit none
  integer :: N
  integer :: digit
  integer :: out
  integer :: i
  read(*,*) N
  digit = int(log10(real(N))+1)
  out = 0
  do i = 1, digit-1, 2
     out = out + (10**(i)-10**(i-1))
  end do

  if ( mod(digit,2) /= 0) then
     out = out + N - 10**(digit-1) + 1
  end if
  write(*,'(i0)') out 
  stop
end program main
