#include <bits/stdc++.h>
using namespace std;
int main() {
  string str;
  cin >> str;
  int n = str.length();
  bool ch = true;
  int cnt = 0, cnt2 = 0;
  for (auto &i : str) {
    if (i == '0') {
      ++cnt;
    }
  }
  for (auto &i : str) {
    if (i == '1') {
      ++cnt2;
    }
  }
  int ans = cnt < cnt2 ? cnt : cnt2;
  cout << ans << endl;
}
