<?php
$str_input = trim(fgets(STDIN));
//配列化
for ($i = 0; $i < strlen($str_input); $i++) {
    $input[] = $str_input[$i];
}

//1と０の数を数える
$blue = array_sum($input);
$red = strlen($str_input) - $blue;

if ($blue > $red) {
    $output = $red;
} else {
    $output = $blue;
}

echo $output;

?>
