#include <bits/stdc++.h>
int main() {
  std::string S;
  std::cin >> S;
  int count0 = 0, count1 = 0;
  for (int i = 0; i < S.size(); ++i) {
    if (S[i] == '0') {
      count0++;
    } else {
      count1++;
    }
  }
  std::cout << std::min(count0, count1);
  return 0;
}
