#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  cin >> S;
  int ones = 0, zeros = 0;
  for (int i = 0; i < S.size(); i++) (S[i] == '0') ? ++zeros : ++ones;
  cout << ((zeros < ones) ? zeros : ones) << endl;
  return 0;
}
