sent = str(input())
tmpsent = sent
lis = []
ss = ""
ss2 = ""
prev = [""]
for i in range(int(len(sent) / 2)):
    pv = []
    for p in prev:
        ss = "0" + p + "1"
        ss2 = "1" + p + "0"
        pv.append(ss)
        pv.append(ss2)
        lis.append(ss)
        lis.append(ss2)
    prev = pv

lis.reverse()
loop = True
while loop:
    loop = False
    for l in lis:
        if tmpsent != tmpsent.replace(l, ''):
            tmpsent = tmpsent.replace(l , '')
            loop = True
            break
print(len(sent) - len(tmpsent))
