#include <bits/stdc++.h>
using namespace std;
vector<long long> to[1000005];
int main() {
  string a;
  cin >> a;
  long long b = 0, c = 0;
  for (int i = 0; i < (int)(a.size()); ++i) {
    if (a[i] == '0')
      b++;
    else
      c++;
  }
  cout << min(b, c) << endl;
}
