#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  cin >> S;
  int N;
  N = S.size();
  int cntred = 0;
  int cntblue = 0;
  for (int i = 0; i < N; i++) {
    if (S.at(i) == '1') {
      cntblue++;
    } else {
      cntred++;
    }
  }
  if (cntred <= cntblue) {
    cout << cntblue;
  } else {
    cout << cntred;
  }
}
