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