#include<iostream>
#include<string>
using namespace std;
int main(){
  String s;
  int a,b;
  cin >> s;
  a=count(s.cbegin(),s.cend(),'1');
  b=count(s.cbegin(),s.cend(),'0');
 if(a<=b) cout << a << endl;
  else cout << b << endl;
}

      
    