

count [] _ = 0
count (c:cs) '0'
  | c == '0' = count cs '1'
  | c == '1' = 1 + count cs '1'
count (c:cs) '1'
  | c == '1' = count cs '0'
  | c == '0' = 1 + count cs '0'


ret s = min (count s '0') (count s '1')


main = do
  s <- getLine
  putStrLn $ show $ ret s
