#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int num_zero, num_one = 0;
  for (int i = 0; i < (int)s.size(); i++) {
    char ch = s[i];
    if (ch == '0')
      num_zero++;
    else if (ch == '1')
      num_one++;
  }
  cout << min(num_zero, num_one);
}
