#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int a, b;
  cin >> s;
  a = count(s.cbegin(), s.cend(), '1');
  b = count(s.cbegin(), s.cend(), '0');
  if (a <= b)
    cout << a << endl;
  else
    cout << b << endl;
}
