You are given an array of integers . Your task is to make the array symmetrical with the minimum number of operations.
Definition of a Symmetric Array: An array is considered symmetrical if for all .
Operations Allowed: Before performing any operations, you may shuffle the elements of the array in any order you like. Then, you can perform the following operation any number of times:
- Choose an index and increment the value of by 1, i.e., set .
Objective: Determine the minimum number of operations required to make the array symmetrical.
It's guaranteed that you can always make an array symmetrical.
Input Format:
- The first line of the input contains a single integer — the number of test cases.
- The first line of each test case contains a single integer — the number of elements in the array. The sum of over all sets of input data does not exceed .
- The second line of each test case contains integers — the elements of the array.
Output Format: For each test case, output the minimum number of operations required to make the array symmetrical.
Examples
Input
3
4
1 3 3 1
5
2 3 3 2 1
3
1 2 3
Output
0
0
1
An array of 4 elements: 1 3 3 1.
An array of 5 elements: 2 2 1 3 3.
move 1 to the middle to get 2 1 3 and add 1 to 2 to get 3 1 3
Input
4
4
7 1 5 3
7
1 8 2 16 8 16 31
5
11 2 15 7 10
13
2 1 1 3 3 11 12 22 45 777 777 1500 74
Output
4
1
6
48
Comments