program answer
  implicit none
  integer :: i, j, N, ans, count
  character(len=10**5) :: S
  read(*,*) S
  N=len_trim(S)
  ans=0
  do
     if(count==0) then
        exit
     end if
     count=0
     do i = 1, N-1
        if(S(i:i)=='2') then
           cycle
        else if(S(i:i)=='1') then
           do j = i+1, N
              if(S(j:j)=='2') then
                 cycle
              else if(S(j:j)=='1') then
                 exit
              else if(S(j:j)=='0') then
                 S(i:i)='2'
                 S(j:j)='2'
                 ans=ans+1
                 count=count+1
                 exit
              end if
           end do
        else
            do j = i+1, N
              if(S(j:j)=='2') then
                 cycle
              else if(S(j:j)=='0') then
                 exit
              else
                 S(i:i)='2'
                 S(j:j)='2'
                 ans=ans+1
                 count=count+1
                 exit
              end if
           end do         
        end if
     end do
  end do

  write(*,*) ans*2
  stop
 end program answer
  