#include <bits/stdc++.h>
using namespace std;
int main() {
  string st;
  cin >> st;
  int num_0 = 0;
  int num_1 = 0;
  char ch;
  for (int i = 0; i < st.length(); ++i) {
    ch = st[i];
    if (ch == '0') num_0++;
    if (ch == '1') num_1++;
  }
  cout << min(num_0, num_1) << endl;
  return 0;
}
