#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int x = 0, y = 0;
  string str;
  cin >> str;
  for (int i = 0; i < str.length(); i++) {
    if (str[i] == '0')
      x++;
    else if (str[i] == '1')
      y++;
  }
  printf("%d", min(x, y));
  return 0;
}
