using System;
using System.Linq;
using System.Collections.Generic;
public class Hello{
    public static void Main(){
        var s = Console.ReadLine();
        var cntZero = 0;
        var cntOne = 0;
        
        for(var i = 0;i < s.Length;i++){
            if(s[i] == '0'){
                cntZero++;
            }else{
                cntOne++;
            }
        }
        Console.WriteLine(Math.Min(cntZero,cntOne));
    }
}
