function Main(input){
  
  var str = input.trim();
  var s = str;
  var n = str.length;
  //console.log(n);
  var h = s.split("");
  var a = [];
  var b = [];
  
 for(i=0;i<n;i++){
    if(i%2==0){
      a.push(parseInt(h[i],10));
    }//gusuu ha a
   else if(i%2==1){
     b.push(parseInt(h[i],10));
   }//kisuu ha b
    
 }//for end
  
 //a.map( str => parseInt(str, 10) );
 //b.map( str => parseInt(str, 10) );  
var sum  = function(arr) {
    var sum = 0;
    arr.forEach(function(elm) {
        sum += elm;
    });
    return sum;
};
        //console.log("a:"+a); 
        //console.log("b:"+b);
  var anum = a.length;
  var bnum = b.length;
      //console.log("anum:"+anum);
      //console.log("bnum:"+bnum);
  
  var asum = sum(a);
  var bsum = sum(b);
      //console.log("asum:"+asum);
      //console.log("bsum:"+bsum);
  
  var top0 = anum - asum + bsum;
  var top1 = bnum - bsum + asum;
  
    //console.log("top0:"+top0);
    //console.log("top1:"+top1);
  
  
  if(top0-top1>0){
    var kekka = top1;
  }
  else if (top1-top0>0){
    var kekka = top0;
  }else{
    var kekka = top0;
  }
  
  console.log(kekka);
 
}//function end
 
Main(require("fs").readFileSync("/dev/stdin", "utf8"));