#P9975. Minimum Initial Infection Count

    ID: 23119 Type: Default 1000ms 256MiB

Minimum Initial Infection Count

Minimum Initial Infection Count

Farmer John has \(N\) cows in a line (\(1 \leq N \leq 3\cdot10^5\)). Unfortunately, a disease is spreading. Initially, some cows are infected. Each night, every infected cow infects its adjacent neighbors (if they exist). Once a cow is infected, it remains infected for the rest of the process. After several nights, Farmer John tests the cows and determines which ones are infected.

Your task is to determine the minimum number of cows that must have been initially infected to produce the observed infection pattern.

inputFormat

The first line contains an integer \(N\), the number of cows. The second line contains a string of length \(N\) consisting of characters '0' and '1', where '1' indicates an infected cow and '0' indicates a healthy cow.

outputFormat

Output a single integer representing the minimum number of initially infected cows.

sample

6
011110
1