You may apply the following three operations on any number of times (possibly zero), in any order:
Operation 1: Swap two adjacent characters.
Operation 2: Choose a contiguous substring "00" and replace it with "1".
Operation 3: Choose a contiguous substring "11" and replace it with "0".
Let be the minimum number of operations required to make the string equal to either "0", "1", or "01". If it is impossible to transform into any of these strings, we define .
You are given a binary string .
Compute .
输入格式
The input consists of a single test case of the following format.
The first line contains an integer (), the length of the string. The second line contains a binary string . Each character () is either '0' or '1'.