# -*- coding: utf-8 -*-

import sys

def parse_input(lines_as_string = None):

    lines = []
    if lines_as_string is None:
        lines.append(input())
    else:
        lines = [e for e in lines_as_string.split("\n")][1:-1]
 
    tokens = lines[0].split(" ")
    s = tokens[0]

    return (s,)

def solve(s):
   
    current = s
    tmp = s
    while True:

        current = tmp
        for i in range(len(current) - 1):
            if current[i] == '0' and current[i+1] == '1':
                tmp = current[:i] + current[i+2:]
                break

            if current[i] == '1' and current[i+1] == '0':
                tmp = current[:i] + current[i+2:]
                break

        if len(current) == len(tmp):
            break

    return len(s) - len(current)

def main():

    print("%d" % solve(*parse_input()))

if __name__ == '__main__':

    main()
