#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ll a, b, c, d, e, k, l, m, n, o = 0, p, q, x, y, z, max1 = 0, ans, o0 = 0,
                                o1 = 0;
  string s, t, u;
  cin >> s;
  for (ll i = 0; i < s.size(); i++) {
    if (s[i] == 0) {
      o0++;
    } else
      o1++;
  }
  cout << min(o1, o0) << endl;
}
