Problem: You are given an integer and an array .
In one operation, you can choose an index () for which and delete both and from the array. After deleting and , the remaining parts of the array are concatenated.
For example, if , then after performing an operation with , the resulting array will be .
What is the maximum possible length of an array of equal elements obtainable from by performing several (perhaps none) of the aforementioned operations?
Input Format: Each test contains multiple test cases. The first line of input contains one integer () — the number of test cases. The following lines contain the descriptions of the test cases.
The first line of each test case contains a single integer () — the length of array .
The second line of each test case contains integers () — the elements of array .
It is guaranteed that the sum of across all test cases does not exceed .
Output Format: For each testcase, print a single integer, the maximum possible length of an array of equal elements obtainable from by performing a sequence of operations.
Note: For the first testcase, an optimal sequence of operations would be: .
For the second testcase, all elements in the array are already equal.
For the third testcase, the only possible sequence of operations is: . Note that, according to the statement, the elements deleted at each step must be different.
For the fourth testcase, the optimal sequence of operations is: .
For the fifth testcase, one possible reachable array of two equal elements is .