#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  cin >> S;
  int N0 = 0, N1 = 0;
  for (int i = 0; i < S.length(); i++) {
    if (S[i] == '0')
      N0++;
    else
      N1++;
  }
  cout << min(N0, N1) << endl;
}
