#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main(){
    string S;
    cin >> S;
    int zero,one;
    zero = 0;
    one = 0;
    for(int i = 0; i< S.length();i++){
        if(S[i] == "0") zero += 1;
        else one += 1;
    }
    cout << min(one,zero) << endl;
}