#include <bits/stdc++.h>
using namespace std;
signed main() {
  string S;
  cin >> S;
  long long zero = 0;
  long long one = 0;
  for (long long i = (0); i < (S.size()); ++i) {
    S[i] == '0' ? zero++ : one++;
  }
  cout << min(zero, one) << endl;
}
