#include <bits/stdc++.h>
using namespace std;
int main() {
  char s[100002];
  int len, i, count = 0;
  len = strlen(s);
  for (i = 0; i < len; i++) {
    if (s[i] == '0') count++;
  }
  cout << min(count, len - count);
  return 0;
}
