#include <bits/stdc++.h>
#define MOD (long long)(1E9+7)
#define rep(i, n) for(int i = 0; i < n; i++)

using namespace std;

int main(){
	int c[2];
  	c[0] = c[1] = 0;
  	string s;
	cin >> s;
	rep(i, n.size()) {
    	c[s[i] - '0']++;
    }
  	cout << min(c[0], c[1]) << endl;
}