#!/bin/bash
read input
input_num=${#input}

# create candidate number
pattern1=""
pattern2=""
for i in `seq $input_num`
do
if [ $(( i%2 )) -eq 0 ]; then
 pattern1="$pattern1"'0'
 pattern2="$pattern2"'1'
else
 pattern1="$pattern1"'1'
 pattern2="$pattern2"'0'
fi 
done

# check candidate number
count_p1=0
count_p2=0
for i in `seq $input_num`
do
 str0=`echo ${input:$(( i-1 )):1}`
 str1=`echo ${pattern1:$(( i-1 )):1}`
 str2=`echo ${pattern2:$(( i-1 )):1}`

 if [ $str0 -ne $str1 ]; then
  (( count_p1++ ))
 fi
 if [ $str0 -ne $str2 ]; then
  (( count_p2++ ))
 fi
done

# show answer
if [ $count_p1 -ge $count_p2 ]; then
 echo $count_p2
else
 echo $count_p1
fi