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