def main():
    S = input()

    ans = f(S)
    print(ans)


def f(S):
    """
    A,B,Cそれぞれが存在していたら終了
    存在しない場合
    diff をとる

    """
    bef = S[0]
    b = []
    a = 0
    for c in S:
        if c == '0':
            a += 1
        else:
            a -= 1
        b.append(a)

    from collections import Counter
    c = Counter(b)
    ans = 0
    for v in c.values():
        ans += v // 2 * 2

    # print(c)

    return ans


if __name__ == '__main__':
    main()
