#include <bits/stdc++.h>
using namespace std;
template <class T>
void chmax(T& a, T b) {
  if (a < b) {
    a = b;
  }
}
template <class T>
void chmin(T& a, T b) {
  if (a > b) {
    a = b;
  }
}
int atcoder() {
  string s;
  cin >> s;
  int cnt0 = 0;
  int cnt1 = 0;
  for (int i = 0; i < s.length(); ++i) {
    if (s[i] == '0') cnt0++;
    if (s[i] == '1') cnt1++;
  }
  cout << min(cnt0, cnt1) << "\n";
  return 0;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  atcoder();
  return 0;
}
