Codeforces Round 310 (Div. 2)
A
Case of the Zeros and Ones
Codeforces
900
原题
←B →
翻译中…

Andrewid the Android is a galaxy-famous detective. In his free time he likes to think about strings containing zeros and ones.

翻译中…

Once he thought about a string of length $*n*$ consisting of zeroes and ones. Consider the following operation: we choose any two adjacent positions in the string, and if one them contains 0, and the other contains 1, then we are allowed to remove these two digits from the string, obtaining a string of length $*n* - 2$ as a result.

翻译中…

Now Andreid thinks about what is the minimum length of the string that can remain after applying the described operation several times (possibly, zero)? Help him to calculate this number.

翻译中…

Input

翻译中…

First line of the input contains a single integer $*n*$ ($1 ≤ *n* ≤ 2·10^{5}$), the length of the string that Andreid has.

翻译中…

The second line contains the string of length $*n*$ consisting only from zeros and ones.

翻译中…

Output

翻译中…

Output the minimum length of the string that may remain after applying the described operations several times.

翻译中…

Note

翻译中…

In the first sample test it is possible to change the string like the following: image.

翻译中…

In the second sample test it is possible to change the string like the following: image.

翻译中…

In the third sample test it is possible to change the string like the following: image.

翻译中…

样例

Input #1
4
1100
Output #1
0
InputCopy OutputCopy
Input #2
5
01010
Output #2
1
InputCopy OutputCopy
Input #3
8
11101111
Output #3
6
InputCopy OutputCopy
题目信息
题号
556A
时间限制
1 s
内存限制
256 MB
标签
贪心

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。