Epic Coloring#11836

Epic Coloring

1 second
256 megabytes
Medium

"Epic"

—TheFatRat - Epic

You're given an array of integers. A Coloring is defined as the selection of one pair of integers (a_i, a_j) such that (i < j) to be colored red. All other elements in the array are automatically colored blue.

A Coloring is called Epic if the sum of blue elements and the sum of red elements both have the same parity (odd or even both).

Count how many ways there are to obtain an Epic Coloring.

Input

The first line contains a single integer (1 \le t \le 10^4) – the number of test cases.

The first line of each test case contains a single integer (2 \le n \le 4 \cdot 10^5) – the length of the array .

The second line of each test case contains integers a_1, a_2, ..., a_n (1 \le a_1,a_2,..,a_n \le 10^9) – the array .

It's guaranteed that the sum of overall tests doesn't exceed 4 \cdot 10^5.

Output

For each test case, output the number of such Coloring Configurations.

Please note ! that the answer for some test cases won't fit into 32-bit integer type, so you should use at least 64-bit integer type in your programming language (like long long for C++).

Examples

Example 1

Loading
Loading

Note

In the first test case, there are valid configurations :

  • a=[\textbf{1},2,\textbf{1}] and we've 1+1=2 is even and is even.

  • a=[\textbf{1},\textbf{2},1] and we've 1+2=3 is odd and is odd.

  • a=[1,\textbf{2},\textbf{1}] and we've 2+1=3 is odd and is odd.

In the second test case, there are valid configurations :

  • a=[\textbf{5},\textbf{6},7,8] and we've 5+6=11 is odd and 7+8=15 is odd.

  • a=[\textbf{5},6,\textbf{7},8] and we've 5+7=12 is even and 6+8=14 is even.

  • a=[\textbf{5},6,7,\textbf{8}] and we've 5+8=13 is odd and 6+7=13 is odd.

  • a=[5,\textbf{6},\textbf{7},8] and we've 6+7=13 is odd and 5+8=13 is odd.

  • a=[5,\textbf{6},7,\textbf{8}] and we've 6+8=14 is even and 5+7=12 is even.

  • a=[5,6,\textbf{7},\textbf{8}] and we've 7+8=15 is odd and 5+6=11 is odd.

In the third test case , no valid configuration exists.

Scoring

  1. Subtask ( points) : (n \le 4)

  2. Subtask ( points): (1 \le \sum n \le 70)

  3. Subtask ( points) : (1 \le \sum n \le 700)

  4. Subtask : ( points) : (1 \le \sum n \le 4 \cdot 10^5)