program main
implicit none
character :: s*100000
integer   :: i, l, res, iloop, chk( 2 )

read(*,*) s
l = len_trim( s )

do iloop = 1, 2

if( iloop == 1 ) then
   res = 0
else
   res = 1
   if( s(1:1) == '0' ) then
      s(1:1) = '1'
   else
      s(1:1) = '0'
   end if
end if
do i = 2, l
   if( s(i:i) /= s(i-1:i-1) ) then
   else if( i == 2 ) then
      if( s(i-1:i-1) =='0')then
         s(i:i) = '1'
      else
         s(i:i) = '0'
      end if
      res = res + 1
   else
      s(i:i) = s(i-2:i-2)
      res = res + 1
   end if
end do
chk( iloop ) = res
end do

write(*,'(i0)') minval( chk )

end program main
