x = input()
l = len(x)
l0 = sum([1 for c in x if c == '1'])
l1 = l - l0
if l1 == l:
    print(l)
elif l0 == l:
    print(l)
else:
    if l1 < l0:
        print(l - l0 + l1)
    else:
        print(l - l1 + l0)
