#include <bits/stdc++.h>
int string_len(char* str) {
  int len = 0;
  while (str[len] != 0) {
    len++;
  }
  return len;
}
int main(void) {
  char S[100001];
  scanf("%s", S);
  int N = string_len(S);
  int R = 0;
  int B = 0;
  for (int i = 0; i < N; i++) {
    if (S[i] == '0')
      R++;
    else
      B++;
  }
  printf("%d\n", ((R) < (B) ? (R) : (B)));
  return 0;
}
