#include <bits/stdc++.h>
using namespace std;
int main() {
  char s[100000];
  cin >> s;
  int count0, count1;
  for (int i = 0; i < sizeof(s); i++) {
    if (s[i] == '0') count0++;
    if (s[i] == '1') count1++;
  }
  cout << min(count0, count1) << endl;
  return 0;
}
