PivotOJ

Cowntact Tracing 2

시간 제한: 2000ms메모리 제한: 1024MB출처: USACO 2023 December BronzeBOJ 31064

문제

Farmer John has NN cows in a line (1N31051 \leq N \leq 3\cdot 10^5). Unfortunately, there is a sickness spreading throughout.

Initially, some cows start off infected. Every night, an infected cow spreads the sickness to the cows on their left and right (if they exist). Once a cow is infected, she stays infected.

After some amount of nights, Farmer John realizes that the issue has gotten out of control, so he tests his cows to determine who has the sickness. Find the minimum number of cows that could have started with the sickness.

입력

The first line contains NN, the number of cows that Farmer John has.

The next line contains an NN character bitstring of only 11s and 00s where a 11 represents an infected cow and a 00 represents an uninfected cow after some number of nights.

출력

Output a single integer: the minimum number of cows that could have started with the sickness.

예제

예제 1

입력
5
11111
출력
1

예제 2

입력
6
011101
출력
4
코드를 제출하려면 로그인하세요.