#include <bits/stdc++.h>
const long long LINF = 1e18;
const int INF = 1e8;
using namespace std;
int main(void) {
  string s;
  string tmp;
  int z = 0;
  int o = 0;
  long long tobasu[100010] = {};
  long long count = 0;
  cin >> s;
  long long n = s.size();
  for (int i = 0; i < n; i++) {
    if (s[i] == '0')
      o++;
    else
      z++;
  }
  cout << min(o, z) << endl;
}
