#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  while (a % b != 0) {
    int c = 0;
    c = a % b;
    a = b;
    b = c;
  }
  return b;
}
string cube;
int main() {
  cin >> cube;
  int aka = 0, ao = 0;
  for (int i = 0; i < cube.size(); i++) {
    if (cube[i] == '0') {
      aka++;
    } else {
      ao++;
    }
  }
  cout << min(aka, ao) << endl;
  return 0;
}
