using System;

namespace _20190304_05 {
    class Program {
        static void Main(string[] args) {
            var str = Console.ReadLine();
            var c0 = 0;
            var c1 = 0;
            foreach (var c in str) {
                if (c == '0') {
                    c0++;
                } else {
                    c1++;
                }
            }
            Console.WriteLine(Math.Min(c0, c1));
        }
    }
}
