#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int main() {
    string S;
    cin >> S;
    const size_t size = S.size();
    vector<int> ans(2, 0);
    for(int i = 0; i < size; i++) {
        ans[S[i] - '0']++;
    }
    cout << min(ans[0, ans[1]]) << endl;
    return 0;
}