#include <bits/stdc++.h>
using namespace std;
long long N, M, H, W, K, A, B;
string S;
string alpha = "abcdefghijklmnopqrstuvwxyz";
string ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int main() {
  cin >> S;
  long long ss = S.size();
  long long n0 = 0, n1 = 0;
  for (int i = 0; i < ss; i++) {
    if (S[i] == '0')
      ++n0;
    else
      ++n1;
  }
  cout << min(n0, n1) << endl;
}
