#include <bits/stdc++.h>
using namespace std;
int main() {
  string str;
  cin >> str;
  int ones = 0;
  for (int i = 0; i < (int)str.size(); ++i) {
    if (str[i] == '1') {
      ones++;
    }
  }
  int res = min(ones, (int)str.size() - ones);
  cout << res << "\n";
  return 0;
}
