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

string s;
int r, b;

int main()
{
    cin >> s;
    for (int i = 0; i < s.size(); i++)
    {
        if (s[i] == '0')
            r++ else b++;
    }
    cout << min(a, b) << endl;
}