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