import sys


def main(inp):
    cube_state, *cubes = inp
    stack_state = 1
    count = 0
    for cube in cubes:
        if cube == cube_state:
            stack_state += 1
        else:
            stack_state -= 1
            count += 2
        if stack_state == 0:
            if cube_state == "0":
                cube_state = "1"
            else:
                cube_state = "0"
    return count


if __name__ == '__main__':
    inp = sys.stdin.readline().strip()
    print(main(inp))
