#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int main() {
  string s;
  cin >> s;
  cout << min(count(s.begin(), s.end(), '0'), count(s.begin(), s.end(), '1'))
       << endl;
}
