Codeforces Round 1026 (Div. 2)
A
Fashionable Array
Codeforces
800
原题
←B →
翻译中…

In 2077, everything became fashionable among robots, even arrays...

翻译中…

We will call an array of integers $a$ fashionable if $\min(a) + \max(a)$ is divisible by $2$ without a remainder, where $\min(a)$ — the value of the minimum element of the array $a$, and $\max(a)$ — the value of the maximum element of the array $a$.

翻译中…

You are given an array of integers $a_1, a_2, \ldots, a_n$. In one operation, you can remove any element from this array. Your task is to determine the minimum number of operations required to make the array $a$ fashionable.

翻译中…

Input

翻译中…

Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 10^3$). The description of the test cases follows.

翻译中…

The first line of each test case contains one integer $n$ ($1 \leq n \leq 50$) — the size of the array $a$.

翻译中…

The second line of each test case contains $n$ integers $a_1, a_2, \ldots, a_n$ ($1 \leq a_i \leq 50$) — the elements of the array $a$.

翻译中…

Output

翻译中…

For each test case, output one integer — the minimum number of operations required to make the array $a$ fashionable.

翻译中…

Note

翻译中…

In the first test case, at least one element needs to be removed since $\min(a)+\max(a)=2+5=7$, and $7$ is not divisible by $2$. If any of the elements are removed, only one element will remain. Then $\max(a) + \min(a)$ will be divisible by $2$.

翻译中…

In the second test case, nothing needs to be removed since $\min(a)+\max(a)=1+9=10$, and $10$ is divisible by $2$.

翻译中…

In the third test case, you can remove the elements with values $2$ and $4$, then $\min(a)+\max(a)=5+11=16$, and $16$ is divisible by $2$.

翻译中…

样例

Input #1
6
2
5 2
7
3 1 4 1 5 9 2
7
2 7 4 6 9 11 5
3
1 2 1
2
2 1
8
8 6 3 6 4 1 1 6
Output #1
1
0
2
1
1
3
InputCopy OutputCopy
题目信息
题号
2110A
时间限制
1 s
内存限制
256 MB
标签
模拟
排序

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