# -*- 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):
    

    index_list = [(i, False) for i in range(len(s))]

    remained_index_list = [i for (i, removed) in index_list if not removed]

    while True:

        remained_index_list_len_before = len(remained_index_list)

        i = 0
        while i < len(remained_index_list) - 1:
#            print("i=%d" % i)
#            print("remained_index_list=%s" % remained_index_list)

            if s[remained_index_list[i]] == '0' and s[remained_index_list[i+1]] == '1':
                index_list[remained_index_list[i]] = (remained_index_list[i], True)
                index_list[remained_index_list[i+1]] = (remained_index_list[i+1], True)
                i = i + 2
            elif s[remained_index_list[i]] == '1' and s[remained_index_list[i+1]] == '0':
                index_list[remained_index_list[i]] = (remained_index_list[i], True)
                index_list[remained_index_list[i+1]] = (remained_index_list[i+1], True)
                i = i + 2
            else:
                i = i + 1

        remained_index_list = [i for (i, removed) in index_list if not removed]
        remained_index_list_len_after = len(remained_index_list)

        if remained_index_list_len_before == remained_index_list_len_after:
            break

    return len(s) - len(remained_index_list)

def main():

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

if __name__ == '__main__':

    main()
