#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n = 0, k = 0, mini = 999999999;
  long long grid[3][3];
  bool flag = false;
  string str;
  cin >> str;
  for (long long i = 0; i < str.size(); i++) {
    if (str[i] == '0')
      n++;
    else {
      k++;
    }
  }
  cout << min(n, k);
}
