#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using ull = uint64_t;
constexpr ll INF = 1e+15;
void solve(istream &cin) {
  string s;
  cin >> s;
  if (!cin) return;
  ll ans = min(count(s.begin(), s.end(), '0'), count(s.begin(), s.end(), '1'));
  cout << ans << endl;
}
int main(int argc, char *argv[]) {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << setprecision(16) << scientific;
  solve(cin);
  return 0;
}
