#include <bits/stdc++.h>
using namespace std;
bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) {
  return (a.first < b.first);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cout.precision(30);
  string ch;
  cin >> ch;
  long long res1 = 0, res0 = 0;
  for (int i = 0; i < ch.size(); i++) {
    if (ch[i] == '0')
      res0++;
    else
      res1++;
  }
  cout << min(res1, res0);
  return 0;
}
