#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int n = (int)s.length();
  int i;
  int chk[2] = {0, 0};
  for (i = 0; i < n; i++) {
    if (s[i] == '0')
      chk[0]++;
    else
      chk[1]++;
  }
  cout << min(chk[0], chk[1]);
}
