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