#include <bits/stdc++.h>
using namespace std;
int dy[] = {0, 0, 1, -1, 0};
int dx[] = {1, -1, 0, 0, 0};
int main() {
  int a, b, c;
  string s;
  cin >> s;
  int zero = 0;
  int one = 0;
  for (int i = 0; i < (int)s.length(); i++) {
    if (((int)s[i]) == 0) {
      zero++;
    } else {
      one++;
    }
  }
  if (zero > one) {
    cout << zero;
  } else {
    cout << one;
  }
}
