import fractions

S = str(input())
cube = list(S)
count0 = 0
count1 = 0

for string in cube:
    if string == '0':
        count0 = count0 + 1
    else:
        count1 = count1 + 1

print(min(count0,count1))
