#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  string S;
  cin >> S;
  int r = 0, b = 0;
  for (int i = 0; i < S.size(); ++i) {
    if (S[i] == '0') {
      r++;
    } else {
      b++;
    }
  }
  cout << min(r, b);
  return 0;
}
