#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9 + 7;
template <typename T>
T digit(T num) {
  T sum = 0;
  while (num) {
    sum += num % 10;
    num /= 10;
  }
  return sum;
}
int main() {
  string s;
  cin >> s;
  int zero = 0, one = 0;
  for (long long i = 0; i < s.size(); ++i) {
    zero += s[i] == '0';
    one += s[i] == '1';
  }
  int ans = min(zero, one);
  cout << ans << endl;
  return 0;
}
