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