#include <bits/stdc++.h>
using namespace std;

int main() {
	string s;
	int ans = 0, zeros = 0, ones = 0;
	cin >> s;
	for (int i = 0; i < n; i++) {
		if(s[i] == '0')
			zeros++;
		else
			ones++;
	}
	ans = min(zeros, ones);
	cout << ans << endl;
	return 0;
}