CF2110A.Fashionable Array

传统题 时间 2000 ms 内存 256 MiB 3 尝试 1 已通过 1 标签

Fashionable Array

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

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

You are given an array of integers a1,a2,,ana_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 aa fashionable.

Input

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

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

The second line of each test case contains nn integers a1,a2,,ana_1, a_2, \ldots, a_n (1ai501 \leq a_i \leq 50) — the elements of the array aa.

Output

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

Note

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

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

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

Samples

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
1
0
2
1
1
3

在线编程 IDE

建议全屏模式获得最佳体验