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