#include <bits/stdc++.h>
using namespace std;
string S;
int main() {
  cin >> S;
  int c0, c1;
  for (int i = 0; i < S.size() - 1; ++i) {
    if (S[i] == '0')
      c0++;
    else
      c1++;
  }
  cout << (c0 < c1 ? c0 : c1) << endl;
}
