using System.Text;
using System;
using System.Collections.Generic;

public class script
{
	static public void Main(string[] args)
	{
		int count = 0;
		List<int> qube = int.Parse(Console.ReadLine());

		while(qube.Count == 1)
		{
			for (int i = 0; i < qube.Count; i++)
			{
				if((qube[i] == 0 && qube[i + 1] == 1) || (qube[i] == 1 && qube[i + 1] == 0))
				{
					qube.RemoveAt(i);
					qube.RemoveAt(i + 1);
					count++;
				}
			}
		}
		
		Console.WriteLine(count);
	}
}
