#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
int main() {
  string s;
  cin >> s;
  int iti = 0;
  int zero = 0;
  if (s.size() == 1) {
    cout << 0 << endl;
    return 0;
  }
  for (auto &i : s) {
    if (s[i] == '1')
      iti++;
    else
      zero++;
  }
  cout << min(iti, zero) << endl;
  return 0;
}
