program ABC_086_A_PlacingMarbles
implicit none
   integer n
   read(*, *) n
   if(n == 000) then
      write(*, *) 0
   else if(n == 001) then
      write(*, *) 1
   else if(n == 010) then
      write(*, *) 1
   else if(n == 100) then
      write(*, *) 1
   else if(n == 011) then
      write(*, *) 2
   else if(n == 101) then
      write(*, *) 2
   else if(n == 110) then
      write(*, *) 2
   else if(n == 111) then
      write(*, *) 3
   end if
end program ABC_086_A_PlacingMarbles