#include<iostream>
#include<string>

using namespace std;

int main(){
    string s;
    int a, b =0;
    cin >> s;
    a = count(s.cbegin(),s.cend(),"1");
    b = count(s.cbegin(),s.cend(),"0");
    if(a>b) cout << b << endl;
    else cout << a << endl;
}