#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int64_t>>;
const double pi = M_PI;
const int64_t MOD = 1000000007;
int main() {
  string s;
  cin >> s;
  int sn = s.size(), ze = 0, it = 0;
  for (int i = 0; i < sn; i++) {
    if (s[i] == '0') {
      ze++;
    } else {
      it++;
    }
  }
  cout << min(ze, it) << endl;
  return 0;
}
