program tiles
  implicit none
  integer :: i,j,k,N,dif
  character(len=10000) :: S,Sp
  character :: ss

  read(*,*) S
  N=len_trim(S)

  dif=0
  ! comp with                                                                   
  do i=1,N
     j=mod(i,2)
     !write(*,*) j                                                              
     Sp=trim(S)
     ss=Sp(i:i)
     read(ss,*) k
     if(j.eq.k) then
!        write(*,*) "onaji"                                                     
     else
!        write(*,*) "dif"                                                       
        dif=dif+1
     endif
  enddo
  if((N-dif).lt.dif) then
     dif=N-dif
  endif
  write(*,'(i0)') dif

end program tiles

