read S
N=${#S}
TZM=2#010101010101010
TOM=2#101010101010101

temp1=$(( 2#$S ^ TZM ))
temp2=$(( 2#$S ^ TOM ))
cnt1=0
cnt2=0
for i in `seq 0 $(( N - 1 ))`; do
  if [ $(( temp1 & 1 )) -eq 1 ]; then
    cnt1=$(( cnt1 + 1 ))
  else
    cnt2=$(( cnt2 + 1 ))
  fi
  temp1=$(( temp1 >> 1 ))
  temp2=$(( temp2 >> 1 ))
done
if [ $cnt1 -lt $cnt2 ]; then
   min=$cnt1
else
  min=$cnt2
fi
echo $min