program sample
    implicit none
  
    integer(8) :: i,j,m,n
    real(8)::a,b
    integer(8),allocatable :: x(:),y(:)
    character(len=100000)::s
    character(len=1)::t
  
  
    read(*,*)s
    n=len_trim(s)
    m=0
    do i=1,n,2
        if (s(i:i)=='1')then
            m=m+1
        end if
    end do
    do i=2,n,2
        if (s(i:i)=='0')then
            m=m+1
        end if
    end do
    if (n-m<m)then
        m=n-m
    end if

    write(*,*) m
  
    stop
end program sample
  

