EPS/19-02-24/b.py

24 lines
409 B
Python
Raw Normal View History

2024-03-04 16:23:36 +01:00
def main():
ct = int(input())
for i in range(ct):
input()
a = [int(b) for b in input().split()]
b = {}
for c in a:
if c not in b:
b[c] = 0
b[c] += 1
d = [(e, b[e]) for e in b]
d.sort(key=lambda x: x[1], reverse=True)
oth = len(a)-d[0][1]
print(max(d[0][1] - oth, len(a)%2))
main()