s = gets.chomp
n = s.length
counter = 0
s.each_char.with_index do |c, i|
  if (i.even? and c=='0') or (i.odd? and c=='1')
    counter++
  end
end
if counter > n/2
  puts (n-counter).to_s
else
  puts n.to_s
end
         