s = input()
"""
lis = [int(x) for x in s]
counter = 0
che = 1

while che:
    che = 0
    for i in range(len(lis)-1):
        if lis[i] != lis[i+1]:
            lis.pop(i)
            lis.pop(i)
            che = 1
            counter += 2
            break

print(counter)
"""

print(min(s.count(0),s.count(1))