cswork / OA打开练习工作台

SnowflakeOA #40

Custom-Sorted Array

估计简单可在线判题

考点(AI 标注)双指针滑窗

One operation swaps the elements at any two indices. All even numbers must come before all odd numbers. Neither group needs to be sorted internally, and swaps are not limited to adjacent elements.

输入格式

The first line contains n, and the second line contains positive integers. This site uses 1≤n≤200000 and 1≤element≤10⁹.

输出格式

Output the single integer required by the problem.

样例 1

输入:

4
6 3 4 5

输出:

1

样例 2

输入:

4
1 1 2 2

输出:

2

样例 3

输入:

3
2 4 6

输出:

0

样例说明

The answers to the three public examples are, in order: 1; 2; 0. The examples were rechecked by independent enumeration, state search, or direct simulation.