#include <bits/stdc++.h>
using namespace std;
int main(void) {
  string str;
  cin >> str;
  int c0 = count(str.cbegin(), str.cend(), '0');
  int c1 = count(str.cbegin(), str.cend(), '1');
  cout << (c0 < c1 ? c0 : c1) << endl;
  return 0;
}
