S = input()
from collections import deque
q = deque()
ans = 0
for s in S:
    if not q:
        q.append(s)
        continue
    pres = q.pop()
    if (s == '0' and pres == '1') or (s=='1' and pres=='0'):
        ans += 2
    else:
        q.append(pres)
        q.append(s)
print(ans) S = input() S input() input from collections import deque q = deque() q deque() deque ans = 0 ans 0 for s in S:
    if not q:
        q.append(s)
        continue
    pres = q.pop()
    if (s == '0' and pres == '1') or (s=='1' and pres=='0'):
        ans += 2
    else:
        q.append(pres)
        q.append(s) s S if not q:
        q.append(s)
        continue
     not q q q.append(s) q.append q append s continue pres = q.pop() pres q.pop() q.pop q pop if (s == '0' and pres == '1') or (s=='1' and pres=='0'):
        ans += 2
    else:
        q.append(pres)
        q.append(s) (s == '0' and pres == '1') or (s=='1' and pres=='0') s == '0' and pres == '1' s == '0' s '0' pres == '1' pres '1' s=='1' and pres=='0' s=='1' s '1' pres=='0' pres '0' ans += 2 ans 2 q.append(pres) q.append q append pres q.append(s) q.append q append s print(ans) print ans q = deque() deque() q ans += 2 2 ans ans = 0 0 ans pres = q.pop() q.pop() pres S = input() input() S
S = input()
from collections import deque
q = deque()
ans = 0
for s in S:
    if not q:
        q.append(s)
        continue
    pres = q.pop()
    if (s == '0' and pres == '1') or (s=='1' and pres=='0'):
        ans += 2
    else:
        q.append(pres)
        q.append(s)
print(ans)
