#include <bits/stdc++.h>
using namespace std;
const long long MAX5 = 1e+5 + 7;
const long long MAX7 = 1e+7 + 7;
const long long MAXN = MAX7;
const long long INF = 0x7f7f7f7f7f7f7f7f;
const int INFi = 0x7f7f7f7f;
const long long MOD = 1e9 + 7;
long long T = 1;
long long n, x, m, k, u, v;
string second, t;
void MAIN() {
  cin >> second;
  long long c0 = count((second).begin(), (second).end(), '0');
  long long c1 = count((second).begin(), (second).end(), '1');
  cout << min(c0, c1);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << fixed;
  cout << setprecision(12);
  ;
  mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
  ;
  while (T--) {
    MAIN();
  }
  return 0;
}
