Codeforces Round 612 (Div. 2)
C
Garland
Codeforces
未评级
原题
← BD →
翻译中…

Vadim loves decorating the Christmas tree, so he got a beautiful garland as a present. It consists of $n$ light bulbs in a single row. Each bulb has a number from $1$ to $n$ (in arbitrary order), such that all the numbers are distinct. While Vadim was solving problems, his home Carp removed some light bulbs from the garland. Now Vadim wants to put them back on.

翻译中…

image

翻译中…

Vadim wants to put all bulb back on the garland. Vadim defines complexity of a garland to be the number of pairs of adjacent bulbs with numbers with different parity (remainder of the division by $2$). For example, the complexity of 1 4 2 3 5 is $2$ and the complexity of 1 3 5 7 6 4 2 is $1$.

翻译中…

No one likes complexity, so Vadim wants to minimize the number of such pairs. Find the way to put all bulbs back on the garland, such that the complexity is as small as possible.

翻译中…

Input

翻译中…

The first line contains a single integer $n$ ($1 \le n \le 100$) — the number of light bulbs on the garland.

翻译中…

The second line contains $n$ integers $p_1,\ p_2,\ \ldots,\ p_n$ ($0 \le p_i \le n$) — the number on the $i$-th bulb, or $0$ if it was removed.

翻译中…

Output

翻译中…

Output a single number — the minimum complexity of the garland.

翻译中…

Note

翻译中…

In the first example, one should place light bulbs as 1 5 4 2 3. In that case, the complexity would be equal to 2, because only $(5, 4)$ and $(2, 3)$ are the pairs of adjacent bulbs that have different parity.

翻译中…

In the second case, one of the correct answers is 1 7 3 5 6 4 2.

翻译中…

样例

Input #1
5
0 5 0 2 3
Output #1
2
InputCopy OutputCopy
Input #2
7
1 0 0 5 0 0 2
Output #2
1
InputCopy OutputCopy
题目信息
题号
1287C
时间限制
1 s
内存限制
256 MB

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。