#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repl(i,n) for(int64_t i=0;i<(int64_t)(n);i++)
#define MAX_N 10000000
#define ll int64_t
#define all(v) (v).begin(),(v).end()
#define P pair<int,int>
using namespace std;


int main() {
  string s; cin>>s;
  int red=0,blue=0;
  rep(i,n) {
    if(s[i]=='0') red++;
    else if(s[i]=='1') blue++;
  }
  cout<<min(red,blue)<<endl;
  return 0;
}