#include <iostream>
#include <string>
#include <algorithm>

int main()
{
  int S;
  std::cin>>S;
  
  const int Red='0';
  const int Blue='1';
  int redCount=0;
  int blueCount=0;
  for(auto i=S.crbegin();i!=S.crend();i++)
  {
    if(*i==Red)
    {
      redCount++;
    }
    else
    {
      blueCount++;
    }
  }
  
  std::cout<<(std::min)(redCount,blueCount)/2<<std::endl;
  
  return 0;
}