MoEngage gives you an array
of length .
You are required to perform exactly operations on the array. In one operation, you have to pick two indices and and do the following:
- Remove the elements and from array.
- Append to the array.
Note that, after each operation, the size of the array is reduced by one. Thus, after operations, only one element remains in the array.
Find the number of distinct values the remaining element can have after operations.
Input Format
- First line of the input contains , the number of test cases. Then the test cases follow.
- First line of each test case contains an integer denoting the length of the array.
- Second line of each test case contains space-separated integers describing the array .
Output Format
For each test case, print the number of distinct values the remaining element can have after operations.
Constraints
- Sum of over all test cases does not exceed .
Sample Input 1
3
3
4 8 5
1
5
2
2 4
Sample Output 1
2
1
1
Explanation
Test Case : The given array is . There are two possible values the remaining element can have after all the operations. These values are and .
- To get , we first choose and . We remove the elements and and append to the array. After performing the operation, . Next, we choose and . After performing the operation, .
- To get , we first choose and . We remove the elements and and append to the array. After performing the operation, . Next, we choose and . After performing the operation, .
Test Case : The given array is . No operations are possible in the array. So, the only possible value of the remaining element is .
Test Case : The given array is . The only possible value of the remaining element after performing one operation is .
ConversionConversion EmoticonEmoticon