#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int num1 = 0, num0 = 0;
  string s;
  cin >> s;
  for (int k = 0; k < s.size(); k++) {
    if (s[k] - '0' == 1)
      num1++;
    else if (s[k] - '0' == 0)
      num0++;
  }
  cout << min(num1, num0) << "\n";
  return 0;
}
