XrkArul And The Sequence

TimeLimit:1000MS  MemoryLimit:256MB
64-bit integer IO format:%lld
未提交 | 登录后收藏
Problem Description

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.

Input

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.

Output

Outputs an integer for the minimum number of operations that the sequence becomes a non-decreasing sequence.

SampleInput
6
010110
SampleOutput
2

Note:In this example you can reverse s[1] and s[5],and then s becomes to 000111.There's no better way.
Submit
题目统计信息详细
总AC数32
通过人数25
尝试人数28
总提交量158
AC率15.82%
AC该题后可以添加标签
贴完标签可以获得20ACB。
并且可以获得本题所有提交代码查看权限。
点击标题可以显示标签。
如果你还没认真思考过这题,请不要查看标签
如果您已经通过了该题,请务为该题贴上标签

T^T Online Judge

[BUG反馈] [FAQ] [闽ICP备17026590号-1]
当前版本:3.24 系统时间: