Question and Answer from L4-M1
def solve():
n = int(input())
arr = list(map(int, input().split()))
freq = {}
for x in arr:
freq[x] = freq.get(x, 0) + 1
unique_vals = sorted(freq.keys())
beauty_values = set()
# If any element repeats, beauty 0 is possible
if any(c > 1 for c in freq.values()):
beauty_values.add(0)
# Differences between unique values
for i in range(len(unique_vals)):
for j in range(i):
beauty_values.add(unique_vals[i] - unique_vals[j])
print(len(beauty_values))
t = int(input())
for _ in range(t):
solve()