#include <bits/stdc++.h>
using namespace std;
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long ans;
  long long zero = 0, one = 0;
  string s;
  cin >> s;
  for (long long i = 0; i < s.size(); i++) {
    if (s[i] == '0')
      zero++;
    else
      one++;
  }
  cout << min(one, zero) << "\n";
  return 0;
}
