#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  cin >> S;
  int cnt = 0;
  for (int i = 0; i < (int)(S.length()); i++) {
    if (S.at(i) == '0') {
      cnt++;
    }
  }
  cout << min(cnt, int(S.size()) - cnt) << endl;
  return 0;
}
