#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int count_0 = 0, count_1 = 0;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == '0')
      count_0++;
    else
      count_1++;
  }
  cout << min(count_1, count_0) << endl;
  return 0;
}
