read S
BIN=$(( 2#$S ))
N=${#S}
bit=$(( 2#0 ))

cnt1=0
cnt2=0
for i in `seq 1 $N`; do
  if [ $(( $(( BIN ^bit )) & 1 )) -eq 1 ]; then
    cnt1=$(( cnt1 + 1 ))
  else
    cnt2=$(( cnt2 + 1 ))
  fi
  BIN=$(( BIN >> 1 ))
  bit=$(( !bit ))
done

if [ $cnt1 -lt $cnt2 ]; then
  min=$cnt1
else
  min=$cnt2
fi
echo $min