XrkArul has a 01 sequence that can reverse one of them each time (0 change to 1,1 change to 0).
Now XrkArul want to know the minimum number of operations of reverse one of the sequence that can make the sequence a non-decreasing sequence.
Can you please help him?
Note: A non-decreasing sequence in this problem is like 00000111.
The first line is an integer of n (1 <= n <=1e6).
The second line is a string of length n and contains only 0 and 1.
Outputs an integer for the minimum number of operations that the sequence becomes a non-decreasing sequence.
6 010110
2 Note:In this example you can reverse s[1] and s[5],and then s becomes to 000111.There's no better way.