IAEPC Preliminary Contest (Codeforces Round 999, Div. 1 + Div. 2)
A
Kevin and Arithmetic
Codeforces
800
原题
←B →
翻译中…

To train young Kevin's arithmetic skills, his mother devised the following problem.

翻译中…

Given $n$ integers $a_1, a_2, \ldots, a_n$ and a sum $s$ initialized to $0$, Kevin performs the following operation for $i = 1, 2, \ldots, n$ in order:

翻译中…
  • Add $a_i$ to $s$. If the resulting $s$ is even, Kevin earns a point and repeatedly divides $s$ by $2$ until it becomes odd.
翻译中…

Note that Kevin can earn at most one point per operation, regardless of how many divisions he does.

翻译中…

Since these divisions are considered more beneficial for Kevin's development, his mother wants to rearrange $a$ so that the number of Kevin's total points is maximized. Determine the maximum number of points.

翻译中…

Input

翻译中…

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

翻译中…

The first line of each test case contains a single integer $n$ ($1\leq n \leq 100$) — the number of integers.

翻译中…

The second line contains $n$ integers $a_1, a_2, \ldots, a_n$ ($1\leq a_i \leq 10^9$).

翻译中…

Output

翻译中…

For each test case, output one integer — the maximum number of points.

翻译中…

Note

翻译中…

In the first test case, the only arrangement of $a$ is $[1]$. $s$ becomes $1$. Kevin earns no points.

翻译中…

In the second test case, the only possible arrangement of $a$ is $[2, 1]$. $s$ becomes $1$ and $1$ successively. Kevin earns points in both operations.

翻译中…

In the third test case, one possible arrangement of $a$ is $[2, 4, 6]$. $s$ becomes $1$, $5$, and $11$ successively. Kevin earns a point in the first operation.

翻译中…

样例

Input #1
5
1
1
2
1 2
3
2 4 6
4
1000000000 999999999 999999998 999999997
10
3 1 4 1 5 9 2 6 5 3
Output #1
0
2
1
3
8
InputCopy OutputCopy
题目信息
题号
2061A
时间限制
1 s
内存限制
256 MB
标签
数学

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