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

Difficulty: interview

Starter code:

Solutions:
# cook your dish here
try:
 for i in range(int(input())):
  n=int(input())
  l=[int(j) for j in input().split()][:n]
  d={}
  for j in l:
   d[j]=d.get(j,0)+1
  a=len(d)
  c=0
  for j in list(d.keys()):
   while(d[j]>=3):
    d[j]=(d[j]//3)+(d[j]%3)
   if(d[j]==2):
    c=c+1
  if(c&1):
   s=0
   for j in list(d.values()):
    s=s+j
   print(s-c-1)
  else:
   s=0
   for j in list(d.values()):
    s=s+j
   print(s-c)
except:
 pass
    



def ans(n,dic):
 count=0
 remain=0
 for i in dic:
  if dic[i]%2==1:
   count+=1
  else:
   remain+=1
 if remain%2==1:
  count+=remain-1
 else:
  count+=remain
 return count
t=int(input())
for w in range(t):
 n=int(input())
 arr=[int(x) for x in input().split()]
 dic={}
 for i in arr:
  try:
   dic[i]+=1
  except:
   dic[i]=1
 print(ans(n,dic))


def ans(n,dic):
 count=0
 remain=0
 for i in dic:
  if dic[i]%2:
   count+=1
  else:
   remain+=1
 if remain%2:
  count+=remain-1
 else:
  count+=remain
 return count
t=int(input())
for w in range(t):
 n=int(input())
 arr=[int(x) for x in input().split()]
 dic={}
 for i in arr:
  try:
   dic[i]+=1
  except:
   dic[i]=1
 print(ans(n,dic))

# -*- coding: utf-8 -*-
"""
@author: souradeep1999

"""

import math as ma
def num():
 return list(map(int , input().split()))
def nu():
 return int(input())
def li():
 return input().split()
def lli ():
 return list (map (int, input ().split ()))
def fli():
 return [float(x) for x in input().split()]

t = nu()
for tt in range(t):
 n = nu()
 a = lli()
 a.sort()
 d = 1
 for i in range(1, n):
  if(a[i] != a[i - 1]):
   d = d + 1
 cnt = 0
 c = 1
 for i in range(1, n):
  if(a[i] == a[i - 1]):
   c = c + 1
  else:
   if(c % 2 == 0):
    cnt = cnt + 1
   c = 1
 if(c % 2 == 0):
  cnt = cnt + 1;

 if(cnt % 2 == 1):
  d = d - 1

 print(d)


def chk(n):
 return (n%2)
def ans(n,dic):
 count=0
 remain=0
 for i in dic:
  if chk(dic[i]):
   count+=1
  else:
   remain+=1
 if chk(remain):
  count+=remain-1
 else:
  count+=remain
 return count
t=int(input())
for w in range(t):
 n=int(input())
 arr=[int(x) for x in input().split()]
 dic={}
 for i in arr:
  try:
   dic[i]+=1
  except:
   dic[i]=1
 print(ans(n,dic))

def chk(n):
 return (n&1)
def ans(n,dic):
 count=0
 remain=0
 for i in dic:
  if chk(dic[i]):
   count+=1
  else:
   remain+=1
 if chk(remain):
  count+=remain-1
 else:
  count+=remain
 return count
t=int(input())
for w in range(t):
 n=int(input())
 arr=[int(x) for x in input().split()]
 dic={}
 for i in arr:
  try:
   dic[i]+=1
  except:
   dic[i]=1
 print(ans(n,dic))

# cook your dish here
import sys
input=sys.stdin.readline
T=int(input())
for i in range (T):
 N=int(input())
 A=list(map(int,input().split()))
 B=[0 for i in range(N+1)]
 fc=0
 flag=0
 for i in A:
  if (B[i]!=1):
   fc=fc+1
   B[i]=B[i]+1
  else:
   flag=flag+1
 if (flag%2==0):
  print(fc)
 else:
  print(max(fc-1,1))
   
   
 


t = int(input())
for _ in range(t):
 n = int(input())
 cards = list(map(int,input().split()))
 unique_cards=set(cards)
 
 if (len(cards)-len(unique_cards))&1:
  print(len(unique_cards)-1)
 else:
  print(len(unique_cards))

# cook your dish here
t = int(input())
for z in range(t):
 n = int(input())
 arr = [int(i) for i in input().split()]
 s = len(set(arr))
 if((n-s)%2==0):
  print(s)
 else:
  print(s-1)

for t in range(int(input())):
 n=int(input())
 l=list(map(int,input().split()))
 D={}
 for i in l:
  if i in D:
   D[i]+=1
  else:
   D[i]=1
 d={1:0,2:0,3:0}
 for i in list(D.values()):
  if(i==1):
   d[1]+=1
  elif(i%2==0):
   d[2]+=1
  else:
   d[3]+=1
 c=0
 for i in d:
  if(i==1):
   c=c+d[i]
  elif(i==2):
   if(d[2]%2==0):
    c=c+d[2]
   else:
    c=c+d[2]-1
  else:
   c=c+d[3]
 print(c)


tc=int(input())
for i in range(tc):
 length=int(input())
 l1=input().split()
 l1 = list(set(l1))
 new_length=len(l1)
 diff=length-new_length
 if diff%2==1:
  diff=diff+1
 print(length-diff)

tc=int(input())
for i in range(tc):
 length=int(input())
 l1=input().split()
 l1 = list(set(l1))
 new_length=len(l1)
 diff=length-new_length
 if diff%2==1:
  diff=diff+1
 print(length-diff)

for _ in range(int(input())):
 n=int(input())
 l=list(map(int,input().split()))
 d={}
 for i in l:
  if i in d:
   d[i]+=1
  else:
   d[i]=1
 nd={1:0,2:0,3:0}
 for i in list(d.values()):
  if(i==1):
   nd[1]+=1
  elif(i%2==0):
   nd[2]+=1
  else:
   nd[3]+=1
 c=0
 for i in nd:
  if(i==1):
   c=c+nd[i]
  elif(i==2):
   if(nd[2]%2==0):
    c=c+nd[2]
   else:
    c=c+nd[2]-1
  else:
   c=c+nd[3]
 print(c)
   


# cook your dish here
I=lambda:list(map(int,input().split()))
t=I()[0]
while(t):
 t-=1
 n=I()[0]
 arr=I()
 d={}
 for i in arr:
  d[i]=0
 for i in arr:
  d[i]+=1
 extra=0
 for i in list(d.keys()):
  if(d[i]>1):
   extra+=(d[i]-1)
 if(extra%2):
  extra+=1
 print(n-extra)


# cook your dish here
for _ in range(int(input())):
 n = int(input())
 arr = [int(i) for i in input().split()]
 arr1 = set(arr)
 dif = n - len(arr1)
 print(n - dif - (dif % 2))