n = int(input())
def tekrar(l):
l2 = []
for i in range(len(l)):
if l[i] not in l2:
l2.append(l[i])
return l2
def ye(l,l2):
l3 = [ ]
for i in range(len(l2)):
l3.append(l.count(l2[i]))
return l3
list_khali = []
for i in range(n):
x = int(input())
l = [int(i) for i in input().split()]
l2 = tekrar(l)
l3 = ye(l,l2)
t = sum(l3) - len(l3)
if t % 2 == 0 :
list_khali.append(len(l2))
else:
list_khali.append(len(l2)-1)
for i in list_khali:
print(i)
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define dbl double
#define str string
#define f first
#define s second
void solve(){
ll t;
cin >> t;
while( t-- ){
ll n;
cin >> n;
ll a[100000];
for(int i=0;i<n;i++){
cin >> a[i];
}ll k=0;
sort(a , a+n);
for(int i=0;i<n-1;i++){
if(a[i]==a[i+1]){k++;}
}if(k==0)cout << n << endl;
else if (k%2==0) {cout <<n-k << endl;}
else cout <<n- k- 1 << endl;}}
int main(){
solve();}
1101A - Minimum Integer | 985D - Sand Fortress |
1279A - New Year Garland | 1279B - Verse For Santa |
202A - LLPS | 978A - Remove Duplicates |
1304A - Two Rabbits | 225A - Dice Tower |
1660D - Maximum Product Strikes Back | 1513A - Array and Peaks |
1251B - Binary Palindromes | 768B - Code For 1 |
363B - Fence | 991B - Getting an A |
246A - Buggy Sorting | 884A - Book Reading |
1180A - Alex and a Rhombus | 445A - DZY Loves Chessboard |
1372A - Omkar and Completion | 159D - Palindrome pairs |
981B - Businessmen Problems | 1668A - Direction Change |
1667B - Optimal Partition | 1668B - Social Distance |
88B - Keyboard | 580B - Kefa and Company |
960A - Check the string | 1220A - Cards |
897A - Scarborough Fair | 1433B - Yet Another Bookshelf |