import std.stdio, std.algorithm, std.conv, std.array, std.string;

void main()
{
    auto S = readln.chomp.to!(dchar[]);
    auto a = S.count('0');
    auto b = S.count('1');

    writeln(a > b ? a : b);
}