st = input()
countone = st.count('1')
countzero = st.count('0')
if countone > countzero and countzero > 0:
    print(countone)
elif countone <= countzero and countone > 0:
    print(countzero)
else:
    print('0')