#d2912. 非递减的01序列

非递减的01序列

Non-decreasing 01 Sequence

Problem Description

huaji has a 01 sequence. In one operation, he can flip any single bit (change 0 to 1, or 1 to 0).

Find the minimum number of flips needed to make the sequence non-decreasing.

Input Format

The first line contains an integer nn (1≤n≤1061 \leq n \leq 10^6).

The second line contains a string of length nn consisting only of 0 and 1.

Output Format

Output one integer: the minimum number of operations to turn the sequence into a non-decreasing one.

Sample Input

6
010110

Sample Output

2