#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int maru = 0, bou = 0;
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    if (s.at(i) == '0') {
      maru++;
    }
    if (s.at(i) == '1') {
      bou++;
    }
  }
  cout << min(maru, bou) << endl;
}
