#include <bits/stdc++.h>
using namespace std;
int main(void) {
  long long i, j, k, a = 0, b = 0, c, n, m;
  char s[100010];
  scanf("%s", s);
  n = strlen(s);
  for (i = 0; i < n; ++i) {
    if (s[i] == '0')
      ++a;
    else
      ++b;
  }
  printf("%lld", a < b ? a : b);
  return 0;
}
