S = input()
stack_0 = []
stack_1 = []

for s in S:
    if s == "0":
        if stack_1:
            stack_1.pop()
        else:
            stack_0.append(s)
    else:
        if stack_0:
            stack_0.pop()
        else:
            stack_1.append(s)

print(len(S) - len(stack_0) - len(stack_1)) S = input() S input() input stack_0 = [] stack_0 [] stack_1 = [] stack_1 [] for s in S:
    if s == "0":
        if stack_1:
            stack_1.pop()
        else:
            stack_0.append(s)
    else:
        if stack_0:
            stack_0.pop()
        else:
            stack_1.append(s) s S if s == "0":
        if stack_1:
            stack_1.pop()
        else:
            stack_0.append(s)
    else:
        if stack_0:
            stack_0.pop()
        else:
            stack_1.append(s) s == "0" s "0" if stack_1:
            stack_1.pop()
        else:
            stack_0.append(s)
     stack_1 stack_1.pop() stack_1.pop stack_1 pop stack_0.append(s) stack_0.append stack_0 append s if stack_0:
            stack_0.pop()
        else:
            stack_1.append(s) stack_0 stack_0.pop() stack_0.pop stack_0 pop stack_1.append(s) stack_1.append stack_1 append s print(len(S) - len(stack_0) - len(stack_1)) print len(S) - len(stack_0) - len(stack_1) len(S) - len(stack_0) len(S) len S len(stack_0) len stack_0 len(stack_1) len stack_1 stack_1 = [] [] stack_1 S = input() input() S stack_0 = [] [] stack_0
S = input()
stack_0 = []
stack_1 = []

for s in S:
    if s == "0":
        if stack_1:
            stack_1.pop()
        else:
            stack_0.append(s)
    else:
        if stack_0:
            stack_0.pop()
        else:
            stack_1.append(s)

print(len(S) - len(stack_0) - len(stack_1))
