#include <bits/stdc++.h>
using namespace std;
int in() {
  int a;
  cin >> a;
  return a;
}
void forin(int* x, int y) {
  for (int i = 0; i < y; i++) {
    cin >> x[i];
  }
}
int intpow(int x, int y) {
  double a = x, b = y;
  return pow(a, b);
}
int intfabs(int x) {
  double a = x;
  return fabs(a);
}
int main() {
  string s;
  cin >> s;
  if (s.size() < 2) {
    cout << '0' << endl;
    return 0;
  }
  int o = 0, z = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s.at(i) == '0')
      z++;
    else
      o++;
  }
  cout << min(z, o) << endl;
}
