In these quarantine days, Chef and Chefina are getting bored. So, Chef came up with a game for her. He gets a pack of cards with numbers written on them. Chef then asks her to remove cards from the pack in the following manner: Chefina can choose any 3 cards at a time, having unique values, and remove the smallest and largest of them, and put back the middle one. For example, say Chefina chooses 3 cards that have numbers $x$, $y$, $z$ on them, such that $x <= y <= z$. Then she can throw away cards with number $x$ and $z$, but has to put the card with number $y$ on it back into the pack. Chefina can repeat this process any number of times. As soon as the pack contains cards with unique numbers, the game ends. If Chefina can determine the count of cards that will remain in the end, and tell it to Chef beforehand, she wins the game. Chefina asks for your help to win this game. Given the number written on the cards, help her find the count of cards in the pack when she wins.
$Note:$ You need to maximize the array length or the number of unique elements

-----Input:-----
- The first line of the input consists of a single integer $T$, denoting the number of test cases. Description of $T$ test cases follow.
- The first line of each test case consists of a single integer $N$, denoting the number of cards in the pack
- The next line consists of $N$ space separated numbers $A1$, $A2$ … $An$. For each valid $i (1 <= i <= N)$, the $i$-th card has the number $Ai$ written on it.

-----Output:-----
- For each test case, print the count of the cards that remain in the end.

-----Constraints-----
- $1 \leq T \leq 500$
- $1 \leq N \leq 10^6$
- $1 \leq Ai \leq N$

-----Subtasks-----
- 30 points : $1 \leq T \leq 20$; $ 1 \leq N \leq 5*10^5$
- 70 points : Original constraints

-----Sample Input:-----
2
5
1 2 2 3 5
9
1 2 2 3 3 5 8 8 9

-----Sample Output:-----
3
5

-----EXPLANATION:-----
Test case 1:
Chefina chooses the cards with number: 2, 3, 5, throws away 2 & 5, and puts back 3. So, the pack now contains cards with numbers: 1, 2, 3. Since the pack contains cards with unique numbers only, these are the 3 final cards. 
Test case 2:
Chefina chooses the cards with number: 2, 3, 8, throws away 2 & 8,  and puts back 3. Now the pack contains cards with numbers: 1, 2, 3, 3, 5, 8, 9. Next, she chooses cards with number: 3, 5, 8 throws away 3 & 8, and puts back 5. Now the pack contains cards with number: 1, 2, 3, 5, 9. Since the pack contains cards with unique numbers only, these are the 5 final cards.
Note: There might be multiple options to choose the 3 cards from the pack in any turn

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = 'def chk(n):\n return (n&1)\ndef ans(n,dic):\n count=0\n remain=0\n for i in dic:\n  if chk(dic[i]):\n   count+=1\n  else:\n   remain+=1\n if chk(remain):\n  count+=remain-1\n else:\n  count+=remain\n return count\nt=int(input())\nfor w in range(t):\n n=int(input())\n arr=[int(x) for x in input().split()]\n dic={}\n for i in arr:\n  try:\n   dic[i]+=1\n  except:\n   dic[i]=1\n print(ans(n,dic))'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 13341