program prob2
    implicit none
    character(len=100045)::S
    character(len=1),allocatable::S1(:),S2(:)
    integer::i,j, l, cnt, n, ans1, ans2
    integer::v(1000)
    read(*,*) S
    l = len_trim(S)
    allocate(S1(l),S2(l))

    do i = 1, l
        if(mod(i,2) == 0)then
            S1(i) = "1"
            S2(i) = "0"
        else
            S1(i) = "0"
            S2(i) = "1"
        end if
    end do

    ans1 = 0
    ans2 = 0
    do i = 1, l
        if(S(i:i) .ne. S1(i))then
            ans1 = ans1 + 1
        end if
        if(S(i:i) .ne. S2(i))then
            ans2 = ans2 + 1
        end if
    end do
    if(ans1 > ans2)then
        write(*,*) ans2
    else
        write(*,*) ans1

    end if






    stop
end program
             