object Main extends App {
  var get = readLine
  var a,b = 0
  var i = 0
  if(get.size>0){
  for(i <- get){
    if(i=='0')
    a = a+1
    else
    b= b+1
  }
  }
  if(get.size-a>get.size-b)
	println(get.size/2-a)
  else
    println(get.size/2-b)
}