#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main() {
  string s;
  cin >> s;
  int n = s.size();
  int ans = 0;
  int one = 0;
  int zero = 0;
  for (int i = 0; i < (n); i++) {
    if (s[i] == '0')
      zero++;
    else
      one++;
  }
  ans = min(zero, one);
  cout << ans << endl;
}
