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