cp/codechef/teammate.py
2018-10-20 11:27:47 +07:00

15 lines
338 B
Python

#!/usr/bin/env python3
from collections import defaultdict
for _ in range(int(input())):
n = int(input())
s = map(int, input().split())
d = defaultdict(int)
for i in s: d[i] += 1
result = 0
for value in s.values():
if value % 2:
pass
else:
result += value * (value-1) // 2