program main
 implicit none
 integer*8 N,i,j,k
 read(*,*) N
 k = 0
 j = 1
 do i=1,N
  if(j>N) exit
  if(10 <= j .and. j < 100) then 
   j = 100
  else if(1000 <= j .and. j < 10000) then
   j = 10000
  else if(j >= 100000) then
   exit
  else
   j = j+1
   k = k+1
  end if
 end do
 write(*,*) k  
end program main