#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<functional>
#include<map>
#include<cmath>

using namespace std;

typedef long long ll;
#define INF 1000000007

int main(){
    string s; cin >> s;
    int l = s.size();

    int c0 = 0, c1 = 0;
    for(int i = 0; i < l; i++)
    {
        if(s[i] == '0') c0++
        else c1++;
    }

    cout << min(c0, c1) << "\n";
    return 0;
}
