Argus was charged with guarding Io, which is not an ordinary cow. Io is quite an explorer, and she wanders off rather frequently, making Argus' life stressful. So the cowherd decided to construct an enclosed pasture for Io.

There are $n$ trees growing along the river, where Argus tends Io. For this problem, the river can be viewed as the $OX$ axis of the Cartesian coordinate system, and the $n$ trees as points with the $y$-coordinate equal $0$. There is also another tree growing in the point $(0, 1)$.

Argus will tie a rope around three of the trees, creating a triangular pasture. Its exact shape doesn't matter to Io, but its area is crucial to her. There may be many ways for Argus to arrange the fence, but only the ones which result in different areas of the pasture are interesting for Io. Calculate the number of different areas that her pasture may have. Note that the pasture must have nonzero area.


-----Input-----

The input consists of multiple test cases. The first line contains an integer $t$ ($1 \leq t \leq 100$) — the number of test cases. Then $t$ test cases follow, each one is described in two lines.

In the first line of each test case there is a single integer $n$ ($1 \leq n \leq 50$) denoting the number of trees growing along the river. Next line contains $n$ distinct integers $x_1 < x_2 < \ldots < x_{n - 1} < x_n$ ($1 \leq x_i \leq 50$), the $x$-coordinates of trees growing along the river.


-----Output-----

In a single line output an integer, the number of different nonzero areas that triangles with trees as vertices may have.


-----Examples-----

Input
8
4
1 2 4 5
3
1 3 5
3
2 6 8
2
1 2
1
50
5
3 4 5 6 8
3
1 25 26
6
1 2 4 8 16 32
Output
4
2
3
1
0
5
3
15


-----Note-----

In the first test case, we have $6$ non-degenerate triangles with the following areas: $0.5$, $0.5$, $1$, $1.5$, $1.5$ and $2$. The pasture can have $4$ different areas, and thus $4$ is the answer.

In the second test case, we have $3$ non-degenerate triangles with the following areas: $1$, $1$ and $2$. The pasture can have $2$ different areas, so $2$ is the answer.

The following two drawings present the situation in the second test case. The blue triangles in the first drawing have area $1$. The red triangle in the second drawing has area $2$.

Difficulty: EASY
Tags: Geometry

Mathematics

Complete search
Skill types: Complete search

Starter code:

Solutions:
import math
from collections import defaultdict
for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	b = defaultdict(int)
	for j in range(n - 1):
		for k in range(j + 1, n):
			b[a[k] - a[j]] += 1
	print(len(b))


from sys import stdin, stdout
t = stdin.readline()
t = int(t)
for x in range(t):
	n = stdin.readline()
	n = int(n)
	l = stdin.readline().split()
	l1 = []
	for i in range(len(l)):
		for j in range(i + 1, len(l)):
			c = abs(int(l[i]) - int(l[j]))
			l1.append(c)
	s = set(l1)
	stdout.write(str(len(s)) + '\n')


for _ in range(int(input())):
	n = int(input())
	trees = list(map(int, input().split()))
	s = set()
	for i in range(n):
		for j in range(i + 1, n):
			s.add(trees[j] - trees[i])
	print(len(s))


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		x = list(map(int, input().split()))
		se = set()
		for i in range(n):
			for j in range(i + 1, n):
				se.add(x[j] - x[i])
		print(len(se))
main()


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	b = set()
	l.sort()
	for i in range(len(l)):
		for j in range(i + 1, len(l)):
			b.add(l[j] - l[i])
	print(len(b))


for _ in range(int(input())):
	n = int(input())
	line = [int(c) for c in input().split()]
	line1 = []
	k = 0
	for i in range(n):
		for j in range(i + 1, n):
			if line[j] - line[i] not in line1:
				line1.append(line[j] - line[i])
				k += 1
	print(k)


tC = int(input())
for __ in range(tC):
	N = int(input())
	Cxy = list(map(int, input().split()))
	S = set()
	for i in range(N):
		for j in range(i + 1, N):
			S.add(Cxy[j] - Cxy[i])
	print(len(S))


from sys import stdin as si, stdout as so
for _ in range(int(si.readline())):
	n = int(si.readline())
	a = list(map(int, si.readline().split()))
	l = []
	for i in range(n - 1):
		for j in range(i + 1, n):
			c = a[j] - a[i]
			if c in l:
				continue
			l.append(c)
	so.write(str(len(l)) + '\n')


for _ in range(int(input())):
	n = int(input())
	x = list(map(int, input().split()))
	x1 = 0
	y1 = 1
	z = []
	for i in range(len(x)):
		for j in range(i + 1, len(x)):
			s = 0.5 * abs(x[j] - x[i])
			if s != 0:
				z.append(s)
	print(len(set(z)))


t = int(input())
for _ in range(0, t):
	n = int(input())
	list1 = [int(num) for num in input().split()]
	c = 0
	bases = []
	for i in range(0, len(list1) - 1):
		for j in range(i + 1, len(list1)):
			diff = list1[j] - list1[i]
			if diff not in bases:
				bases.append(diff)
				c += 1
	print(c)


for t in range(int(input())):
	n = int(input())
	s = list(map(int, input().split()))
	if n == 1:
		print(0)
		continue
	r = set()
	for i in range(n - 1):
		for j in range(i + 1, n):
			r.add(s[j] - s[i])
	print(len(r))


import math
testcase = int(input())

def enter():
	rseq = input()
	rseq = rseq.split(' ')
	rseq = list(map(int, rseq))
	return rseq

def area(coord):
	area = []
	for i in range(0, po - 1):
		am = 0.5 * 1 * coord[i]
		for j in range(i + 1, po):
			amn = 0.5 * 1 * coord[j]
			n = amn - am
			area.append(n)
	area = set(area)
	return len(area)
while testcase:
	trees = int(input())
	coord = enter()
	po = len(coord)
	result = area(coord)
	print(result)
	testcase -= 1


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	a = []
	for i in l:
		a.append(i / 2)
	s = set()
	for i in range(n - 1):
		for j in range(i + 1, n):
			s.add(a[j] - a[i])
	print(len(s))


t = int(input())
for i in range(t):
	n = int(input())
	lst = list(map(int, input().split()))
	l = []
	for i in range(len(lst)):
		for j in range(i + 1, len(lst)):
			l.append(lst[j] - lst[i])
	print(len(set(l)))


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	used = [0] * 500
	ans = 0
	for i in range(n):
		for j in range(i + 1, n):
			ans += 1 - used[l[j] - l[i]]
			used[l[j] - l[i]] = 1
	print(ans)


for _ in range(int(input())):
	c = int(input())
	b = list(map(int, input().split()))
	s = set()
	for i in range(c):
		for j in range(i + 1, c):
			s.add(b[j] - b[i])
	print(len(s))


import sys, io, os, math
from math import ceil, log, gcd, inf
from itertools import permutations
mod = 1000000007
mod1 = 998244353

def printlist(n):
	sys.stdout.write(' '.join(map(str, n)) + '\n')
printf = lambda n: sys.stdout.write(str(n) + '\n')

def printns(n):
	sys.stdout.write(str(n))

def intinp():
	return int(sys.stdin.readline())

def strinp():
	return sys.stdin.readline()

def arrinp():
	return list(map(int, sys.stdin.readline().strip().split()))

def mulinp():
	return map(int, sys.stdin.readline().strip().split())

def flush():
	return sys.stdout.flush()

def power_two(x):
	return 1 << x

def lcm(a, b):
	return a * b // gcd(a, b)

def solve():
	n = intinp()
	t = arrinp()
	a = set()
	for i in range(0, n):
		for j in range(i + 1, n):
			a.add(abs(t[i] - t[j]))
	print(len(a))

def main():
	tc = intinp()
	while tc:
		solve()
		tc -= 1
main()


from itertools import combinations
tc = int(input())
while tc > 0:
	n = int(input())
	ans = len(set([p[1] - p[0] for p in combinations(map(int, input().split()), 2)]))
	print(ans)
	tc -= 1


for _ in range(int(input())):
	n = int(input())
	x = list(map(int, input().split()))
	b = set()
	for i in range(n - 1):
		for j in range(i + 1, n):
			b.add(x[j] - x[i])
	print(len(b))


for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	b = []
	for i in range(n):
		for j in range(i + 1, n):
			b.append(a[j] - a[i])
	c = []
	for i in b:
		if i not in c:
			c.append(i)
	print(len(c))


import math
import sys
import itertools
import fractions
wtf = sys.stdin.read()
wtf = wtf.strip().split('\n')
for t in [wtf[i:i + 2] for i in range(1, len(wtf), 2)]:
	n = int(t[0])
	X = list(map(int, t[1].split()))
	tmp = []
	for (i, x) in enumerate(X):
		for j in range(i + 1, n):
			tmp.append(X[j] - x)
	print(len(set(tmp)))


import sys

def geti(a):
	return int(float(a))
test = geti(input())
tmp = ''
l = []
f = []
while test:
	n = geti(input())
	tmp = input().split()
	l = []
	f = []
	l = list(tmp)
	for i in range(0, n):
		l[i] = geti(l[i])
	for i in range(0, n - 1):
		for j in range(i + 1, n):
			f.append(abs(l[j] - l[i]))
	f = list(set(f))
	print(len(f))
	test -= 1
sys.exit()


t = int(input())
while t:
	t -= 1
	n = int(input())
	n_list = list(map(int, input().split()))
	s = {}
	s = set(s)
	for i in range(n):
		for j in n_list[i + 1:]:
			s.add(abs(n_list[i] - j))
	print(len(s))


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for _ in range(int(input())):
	n = int(input())
	lis = list(map(int, input().split()))
	ans = []
	for i in range(1, n):
		for k in lis:
			if 0 < k - lis[i - 1]:
				ans.append(k - lis[i - 1])
	if 0 < len(ans):
		print(len(set(ans)))
	else:
		print(0)
pass


import math
t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	ss = set()
	for i in range(len(l)):
		for j in range(i + 1, len(l)):
			a = l[j] - l[i]
			b = (l[i] * l[i] + 1) ** 0.5
			c = (l[j] * l[j] + 1) ** 0.5
			s = (a + b + c) / 2
			area = (s * (s - a) * (s - b) * (s - c)) ** 0.5
			ss.add('%.2f' % area)
	print(len(ss))


from math import *
sInt = lambda : int(input())
mInt = lambda : map(int, input().split())
lInt = lambda : list(map(int, input().split()))
t = sInt()
for _ in range(t):
	n = sInt()
	a = lInt()
	b = []
	for i in range(n):
		for j in range(i + 1, n):
			b.append(a[j] - a[i])
	print(len(set(b)))


num = int(input())
for i in range(num):
	n = int(input())
	arr = input()
	arr = arr.split(' ')
	arr = [int(x) for x in arr]
	result = []
	for j in range(n - 1):
		for k in range(j + 1, n):
			if (arr[k] - arr[j]) / 2 not in result:
				result.append((arr[k] - arr[j]) / 2)
	print(len(result))


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	lens = set((a[i] - a[j] for j in range(n) for i in range(j + 1, n)))
	print(len(lens))


import os
import sys
from io import BytesIO, IOBase
import heapq as h
from bisect import bisect_left, bisect_right
import time
from types import GeneratorType
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			self.os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from collections import defaultdict as dd, deque as dq, Counter as dc
import math, string
start_time = time.time()

def getInts():
	return [int(s) for s in input().split()]

def getInt():
	return int(input())

def getStrs():
	return [s for s in input().split()]

def getStr():
	return input()

def listStr():
	return list(input())

def getMat(n):
	return [getInts() for _ in range(n)]

def isInt(s):
	return '0' <= s[0] <= '9'
MOD = 998244353

def solve():
	N = getInt()
	A = getInts()
	poss = set()
	for i in range(N):
		for j in range(i + 1, N):
			if A[j] != A[i]:
				poss.add(A[j] - A[i])
	return len(poss)
for _ in range(getInt()):
	print(solve())


def fun(ls):
	st = set()
	for i in range(len(ls)):
		for j in range(i + 1, len(ls)):
			st.add(abs(ls[i] - ls[j]) / 2)
	print(len(st))
T = int(input())
for i in range(T):
	t = int(input())
	ls = list(map(int, input().split()))
	fun(ls)


for _ in range(int(input())):
	(_, x) = (input(), [*map(int, input().split())])
	print(len(set((j - i for i in x[:-1] for j in x[x.index(i) + 1:]))))


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().strip().split()))
	ans = 0
	edges = set()
	for j in range(n):
		k = 1
		while j + k < n:
			if arr[j + k] - arr[j] not in edges:
				edges.add(arr[j + k] - arr[j])
				ans += 1
			k += 1
	print(ans)


t = int(input())
while t > 0:
	n = input()
	l = list(map(int, input().split(' ')))
	result = set()
	for i in range(0, len(l) - 1):
		for j in range(i + 1, len(l)):
			result.add(l[j] - l[i])
	print(len(result))
	t -= 1


from itertools import combinations
t = int(input())
for _ in range(t):
	n = int(input())
	x = list(map(int, input().split()))
	perms = {abs(a - b) for (a, b) in combinations(x, 2)}
	print(len(perms))


import sys
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
(t,) = I()
for _ in range(t):
	(n,) = I()
	l = I()
	an = 0
	s = set()
	for i in range(n):
		for j in range(i + 1, n):
			if abs(l[i] - l[j]) not in s:
				s.add(abs(l[i] - l[j]))
				an += 1
	print(an)


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	ans = set()
	for i in range(len(a) - 1):
		b = [a[j] - a[i] for j in range(i + 1, len(a))]
		ans = ans | set(b)
	print(len(ans))


def countDi(arr):
	return len(Counter(arr).keys())
from collections import Counter
t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	v = []
	for i in range(len(l)):
		for j in range(len(l)):
			v.append(l[i] - l[j])
	for i in range(len(v)):
		v[i] = abs(v[i])
	res = countDi(v) - 1
	print(res)


t = int(input())
while t > 0:
	n = int(input())
	a = list(map(int, input().split()))
	areas = []
	for i in a:
		for j in a:
			if i != j:
				areas.append(abs(i - j))
	print(len(set(areas)))
	t -= 1


def find(arr):
	if len(arr) == 1:
		return
	for x in range(1, len(arr)):
		if not arr[x] - arr[0] in sol:
			sol.append(arr[x] - arr[0])
	find(arr[1:])
t = int(input())
for o in range(t):
	input()
	trees = [int(x) for x in input().split()]
	sol = []
	find(trees)
	print(len(sol))


def io(arr):
	mydict = {}
	count = 0
	if len(arr) == 1:
		return 0
	for i in range(0, len(arr)):
		for j in range(i + 1, len(arr)):
			diff = abs(arr[i] - arr[j])
			if diff not in mydict:
				mydict[diff] = 1
	for i in mydict:
		count += 1
	return count
t = int(input())
for i in range(0, t):
	n = input()
	arr = list(map(int, input().strip().split()))
	print(io(arr))


t = int(input())
for i in range(t):
	n = int(input())
	areas = []
	arvores = [int(x) for x in input().split()]
	for j in range(n):
		for k in range(j + 1, n):
			diferenca = arvores[k] - arvores[j]
			if diferenca not in areas:
				areas.append(diferenca)
	print(len(areas))


def calculate_triangles(n, coordinates):
	areas = []
	for i in range(n):
		for j in range(i, n):
			area = abs(coordinates[i] - coordinates[j]) * 1 / 2
			if area not in areas:
				areas.append(area)
	return len(areas) - 1
t = int(input())
for i in range(t):
	n = int(input())
	coordinates = list((int(num) for num in input().split(' ')))
	print(calculate_triangles(n, coordinates))


t = int(input())
for _ in range(t):
	n = int(input())
	ali = list(map(int, input().split()))
	s = set()
	for i in range(n):
		for j in range(i + 1, n):
			q = abs(ali[i] - ali[j])
			s.add(q)
	print(len(s))


def distinctArea(a):
	b = []
	for i in range(0, len(a) - 1):
		for j in range(i + 1, len(a)):
			b.append(a[j] - a[i])
	return len(set(b))
t = int(input())
for i in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	print(distinctArea(a))


for _ in [*open(0)][2::2]:
	r = list(map(int, _.split()))
	print(len(set((abs(i - j) for i in r for j in r if i != j))))


def main():
	n = int(input())
	arr = list(map(int, input().split()))
	ans = set([arr[j] - arr[i] for i in range(n) for j in range(i + 1, n)])
	print(len(ans))
T = int(input())
for _ in range(T):
	main()


import math
t = int(input())
for i in range(0, t):
	n = int(input())
	trees = input().split()
	trees = [int(x) for x in trees]
	areas = []
	for j in range(0, len(trees) - 1):
		for k in range(j + 1, len(trees)):
			areas.append(trees[k] - trees[j])
	ans = set(areas)
	print(len(ans))


import os
from heapq import heapify, heappop, heappush
import sys
import sys, threading
import math
import operator
import bisect
from collections import defaultdict
from io import BytesIO, IOBase
sys.setrecursionlimit(10 ** 5)

def inpt():
	return [int(k) for k in input().split()]

def main():
	for _ in range(int(input())):
		n = int(input())
		ar = inpt()
		d = defaultdict(float)
		for i in range(n - 1):
			for j in range(i + 1, n):
				area = (ar[j] - ar[i]) / 2
				d[area] += 1
		print(len(d))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


def solve():
	n = int(input())
	a = list(map(int, input().split()))
	k = set()
	for i in range(n - 1):
		for j in range(i + 1, n):
			k.add(a[j] - a[i])
	print(len(k))
for _ in range(int(input())):
	solve()


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	arr = [int(x) for x in input().split()]
	area = set()
	for i in range(n):
		for j in range(i + 1, n):
			if arr[j] - arr[i] not in area:
				area.add(arr[j] - arr[i])
	print(len(area))


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().strip().split()))
	co = 0
	la = []
	for i in range(n - 1):
		for j in range(i + 1, n):
			p = l[j] - l[i]
			if p not in la:
				la.append(p)
				co += 1
	print(co)


for s in [*open(0)][2::2]:
	a = (*map(int, s.split()),)
	print(len({abs(x - y) for x in a for y in a}) - 1)


def method_1(arr, n):
	s = set()
	for i in range(n - 1):
		for j in range(i + 1, n):
			s.add(arr[j] - arr[i])
	return len(s)
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	print(method_1(arr, n))


for _ in range(int(input())):
	n = int(input())
	(*l,) = map(int, input().split())
	(l1, l2) = ([], [])
	for i in range(1, n):
		l1.append(0.5 * (l[i] - l[i - 1]))
	for i in range(n - 1):
		a = 0
		for j in l1[i:]:
			a += j
			l2.append(a)
	print(len(set(l2)))


import math as m
t = int(input())
while t:
	x = 0
	f = set()
	n = int(input())
	l = list(map(int, input().split()))
	for i in range(n):
		a = m.sqrt(l[i] ** 2 + 1)
		for j in range(i + 1, n):
			b = l[j] - l[i]
			c = m.sqrt(l[j] ** 2 + 1)
			if a + b > c and a + c > b and (b + c > a):
				p = (a + b + c) / 2
				f.add(round(m.sqrt(p * (p - a) * (p - b) * (p - c)), 2))
	print(len(f))
	t -= 1


from sys import stdout, stdin

def input():
	return stdin.readline().strip()

def print(*args, sep=' ', end='\n'):
	stdout.write(sep.join((str(arg) for arg in args)))
	stdout.write(end)

def listInput():
	return [int(x) for x in input().split()]

def solve():
	n = int(input())
	a = listInput()
	a.sort()
	ans = set()
	for i in range(n):
		for j in range(n):
			ans.add(abs(a[i] - a[j]))
	if 0 in ans:
		ans.remove(0)
	print(len(ans))
testsCount = int(input())
for _ in range(testsCount):
	solve()
stdout.flush()


t = int(input())
answers = []
for i in range(t):
	n = int(input())
	x = list(map(int, input().split()))
	set = {0}
	for j in range(n - 1):
		for k in range(j + 1, n):
			set.add(x[k] - x[j])
	answers.append(len(set) - 1)
for answer in answers:
	print(answer)


k = int(input())
while k > 0:
	n = int(input())
	l = list(map(int, input().split()))
	arr = []
	arr = [0 for i in range(51)]
	answ = 0
	for i in range(0, n - 1):
		for j in range(i + 1, n):
			dif = l[j] - l[i]
			if arr[dif] == 0:
				answ = answ + 1
				arr[dif] += 1
	print(answ)
	k = k - 1


for p in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	st = set()
	for i in range(n):
		for j in range(i + 1, n):
			st.add(a[j] - a[i])
	print(len(st))


mas = list(map(int, input().split()))
t = mas[0]
for j in range(t):
	mas = list(map(int, input().split()))
	l = mas[0]
	mas = list(map(int, input().split()))
	s = set()
	for i in range(l):
		for j in range(l):
			if i < j:
				s.add(abs(mas[i] - mas[j]))
	print(len(s))


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def solve(n, ass):
	if n == 1:
		return 0
	s = set()
	for i in range(n):
		for j in range(i):
			s.add(ass[i] - ass[j])
	return len(s)
for _ in range(inp()):
	n = inp()
	ass = inlt()
	print(solve(n, ass))


for _ in range(int(input())):
	n = int(input())
	A = [int(x) for x in input().split()]
	B = set()
	for i in range(n):
		for j in range(i + 1, n):
			B.add(A[j] - A[i])
	print(len(B))


for _ in range(int(input())):
	m = int(input())
	x = []
	p = list(map(int, input().split()))
	for i in range(m - 1):
		for j in range(i + 1, m):
			x.append((p[j] - p[i]) / 2)
	a = set(x)
	print(len(a))


qqq = int(input())
for kkk in range(qqq):
	numi = int(input())
	arr = list(map(int, input().split()))
	zxc = dict()
	cnt = 0
	for i in range(len(arr) - 1):
		for j in range(i + 1, len(arr)):
			x1 = arr[i]
			y1 = 0
			x2 = arr[j]
			y2 = 0
			x3 = 0
			y3 = 1
			temp = 0.5 * abs(abs(x1 - x3) * abs(y2 - y3) - abs(x2 - x3) * abs(y1 - y3))
			if temp not in zxc:
				cnt += 1
				zxc[temp] = 1
			else:
				zxc[temp] += 1
	print(cnt)


from itertools import combinations
out = []
for _ in range(int(input())):
	m = input()
	n = list(map(int, input().split()))
	o = [abs(a - b) for (a, b) in combinations(n, 2)]
	l = len(set(o))
	out.append(l)
for i in out:
	print(i)


def area(x1, x2):
	return (x2 - x1) / 2
t = int(input())
while True:
	n = int(input())
	l = list(map(int, input().split()))
	p = set()
	for i in range(n - 1):
		for j in range(i + 1, n):
			p.add(area(l[i], l[j]))
	print(len(p))
	t -= 1
	if t == 0:
		break


for i in range(int(input())):
	n = int(input())
	a = [*map(int, input().split())]
	g = set()
	for i in range(n):
		for j in range(i + 1, n):
			g.add(a[j] - a[i])
	print(len(g))


t = int(input())
for inh in range(0, t):
	n = int(input())
	a = list(map(int, input().split()))
	ans = set()
	a.sort(reverse=True)
	for i in range(0, n - 1):
		k = a[i]
		for j in range(i + 1, n):
			d = k - a[j]
			ans.add(d)
	print(len(ans))


from sys import stdin, stdout
for test in range(int(input())):
	n = int(stdin.readline())
	arr = list(map(int, stdin.readline().split()))
	arr1 = {}
	for i in range(n):
		for j in range(i):
			area = abs(arr[i] - arr[j])
			if area != 0:
				arr1[area] = 1
	print(len(arr1))


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	ans = []
	for i in range(0, n):
		for j in range(i + 1, n):
			base = abs(l[i] - l[j])
			area = base / 2
			if area not in ans:
				ans.append(area)
	print(len(ans))


def solve():
	n = int(input())
	a = list(map(int, input().split()))
	vals = set()
	for (i, v) in enumerate(a):
		for j in a[i + 1:]:
			vals.add((j - v) / 2)
	print(len(vals))

def main():
	t = 1
	t = int(input())
	for _ in range(t):
		solve()
main()


import math
t = int(input())
for asd in range(t):
	n = int(input())
	s = input().split(' ')
	a = []
	for c in s:
		a.append(int(c))
	b = []
	for i in range(n - 1):
		for j in range(i + 1, n):
			s1 = (a[j] - a[i]) / 2
			if not s1 in b:
				b.append(s1)
	print(len(b))


import math
import collections
import bisect

def arrPrint(a):
	return ' '.join([str(i) for i in a])

def gridPrint(a):
	return '\n'.join([' '.join([str(j) for j in a[i]]) for i in range(n)])

def solve(n, x):
	cnt = collections.Counter()
	for i in range(n):
		for j in range(i + 1, n):
			cnt[x[j] - x[i]] += 1
	ans = 0
	for i in cnt:
		ans += 1
	return ans
t = int(input())
for t in range(t):
	n = int(input())
	x = [int(s) for s in input().split()]
	result = solve(n, x)
	print(result)


t = int(input())
while t:
	t -= 1
	n = int(input())
	x = []
	a = list(map(int, input().split()))
	for i in range(n):
		for j in range(i + 1, n):
			x.append(a[i] - a[j])
	print(len(set(x)))


t = int(input())
while t:
	t = t - 1
	n = int(input())
	l = list(map(int, input().split()))
	p = []
	for i in range(n):
		for j in range(i + 1, n):
			area = abs(l[i] - l[j]) / 2
			p.append(area)
	print(len(list(set(p))))


t = int(input())
for ahdj in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	ans = set()
	for i in range(n):
		for j in range(i + 1, n):
			ans.add(a[j] - a[i])
	print(len(ans))


t = int(input())
result = []
for i in range(0, t):
	n = int(input())
	a = [int(s) for s in input().split()]
	check = []
	for j in range(0, n):
		for k in range(1, n):
			S = (a[k] - a[j]) / 2
			if S not in check and S > 0:
				check.append(S)
	result.append(str(len(check)))
print('\n'.join(result))


n = int(input())
for i in range(n):
	m = int(input())
	nums = list(map(int, input().split()))
	p = set()
	for k in range(0, m):
		for j in range(k + 1, m):
			p.add(nums[j] - nums[k])
	print(len(p))


t = int(input())
for i in range(t):
	n = int(input())
	lista = list(map(int, input().split()))
	x = []
	for j in range(n):
		if j != n - 1:
			for k in range(j + 1, n):
				dif = lista[k] - lista[j]
				if dif not in x:
					x.append(dif)
	print(len(x))


import sys
input = sys.stdin.readline
for f in range(int(input())):
	n = int(input())
	x = list(map(int, input().split()))
	p = []
	for i in x:
		for j in x:
			if abs(i - j) not in p:
				p.append(abs(i - j))
	print(len(p) - 1)


t = int(input())
for _ in range(t):
	n = int(input())
	x_coor = [int(s) for s in input().split(' ')]
	if len(x_coor) == 1:
		ans = 0
	else:
		diff = []
		for x in range(n - 1):
			for y in range(x + 1, n):
				a = abs(x_coor[x] - x_coor[y])
				diff.append(a)
		ans = len(set(diff))
	print(ans)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	fin = set()
	for i in range(len(a)):
		for j in range(i + 1, len(a)):
			ar1 = a[i] / 2
			ar2 = a[j] / 2
			ar3 = ar2 - ar1
			if ar3 not in fin:
				fin.add(ar3)
	print(len(fin))


for _ in range(int(input())):
	n = int(input())
	a = sorted(map(int, input().split()))
	s = set()
	for i in range(n):
		for j in range(i + 1, n):
			s.add(a[j] - a[i])
	print(len(s))


t = int(input())
for i in range(t):
	n = int(input())
	x = list(map(int, input().split()))
	ans = set()
	for j in range(len(x)):
		for k in range(j + 1, len(x), 1):
			ans.add(x[k] - x[j])
	print(len(ans))
	ans = set()


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	ans = [abs(i - j) for i in a for j in a if i != j]
	x = set(ans)
	print(len(x))


count = 0
flag = 0
for _ in range(int(input())):
	n = int(input())
	x = list(map(int, input().split()))
	for k in range(max(x) - min(x) + 1):
		for i in range(n):
			for j in range(n):
				if x[j] - x[i] == k + 1:
					count += 1
					flag = 1
					break
				else:
					flag = 0
			if flag == 1:
				break
		flag = 0
	print(count)
	count = 0


for i in range(int(input())):
	size = int(input())
	v = list(map(int, input().split()))
	aux = set()
	for i in range(size):
		for j in range(i + 1, size):
			aux.add(abs(v[i] - v[j]))
	print(len(aux))


def solve(arr):
	n = len(arr)
	diffs = [arr[i + 1] - arr[i] for i in range(n - 1)]
	s = 0
	sums = [0]
	for i in diffs:
		s += i
		sums += [s]
	st = set()
	m = len(sums)
	for l in range(m - 1):
		for r in range(l + 1, m):
			st |= {sums[r] - sums[l]}
	return len(st)
t = int(input())
ans = []
for i in range(t):
	n = int(input())
	arr = [int(i) for i in input().split()]
	ans.append(solve(arr))
for i in ans:
	print(i)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	b = {abs(x - y) for x in a for y in a}
	print(len(b) - 1)


def f(n, l):
	if n == 1:
		print(0)
	else:
		(a1, co, nl) = (1, 0, [])
		for i in range(n):
			b1 = l[i]
			for j in range(i + 1, n):
				c = l[j]
				aa = abs(b1 * -a1 + c * a1) / 2
				if aa not in nl:
					nl.append(aa)
					co += 1
		print(co)
k = int(input())
for i in range(k):
	n1 = int(input())
	l1 = [int(i) for i in input().split()]
	f(n1, l1)


def compute_triangles_with_different_area(data):
	answer_list = []
	num = 0
	for g in data:
		use_1 = int(g)
		for f in data:
			use_2 = int(f)
			if use_1 != use_2:
				if use_1 > use_2:
					diff = use_1 - use_2
					if diff not in answer_list:
						answer_list.append(diff)
						num += 1
				if use_2 > use_1:
					diff = use_2 - use_1
					if diff not in answer_list:
						answer_list.append(diff)
						num += 1
	return num
num_trails = input()
num_trails = int(num_trails)
sample_list = []
for x in range(num_trails):
	num = input()
	num_list = input()
	num_list = num_list.split(' ')
	for s in num_list:
		sample_list.append(int(s))
	print(compute_triangles_with_different_area(sample_list))
	sample_list = []


import sys

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math
from collections import defaultdict, Counter

def area(x1, y1, x2, y2, x3, y3):
	return 0.5 * (x1 * (y2 - y3) - y1 * (x2 - x3) + (x2 * y3 - y2 * x3))
for _ in range(ri()):
	n = ri()
	l = ria()
	s = set()
	for i in range(n):
		for j in range(i + 1, n):
			s.add(area(0, 1, l[i], 0, l[j], 0))
	print(len(s))


def get_ints():
	return list(map(int, input().split()))
for _ in range(int(input())):
	N = int(input())
	diff = {}
	a = get_ints()
	for i in range(N):
		for j in range(i + 1, N):
			if abs(a[i] - a[j]) not in diff:
				diff[a[j] - a[i]] = 1
	print(len(diff))


for cases in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	x = set()
	for i in range(0, n):
		a1 = a[i]
		for j in range(i, n):
			a2 = a[j]
			b = a2 - a1
			x.add(b)
	print(len(x) - 1)


for _ in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	b = list()
	ar.reverse()
	for i in range(n):
		for j in range(i + 1, n):
			b.append((ar[i] - ar[j]) / 2)
	print(len(set(b)))


t = int(input())
for i in range(0, t):
	n = int(input())
	mlist = []
	nlist = list(map(int, input().split()))
	for j in range(0, n):
		for k in range(j, n):
			mlist.append(nlist[k] - nlist[j])
	ans = list(set(mlist))
	if 0 in ans:
		ans.remove(0)
	print(len(ans))


from sys import stdin, stdout
from collections import *
from math import gcd, floor, ceil

def st():
	return list(stdin.readline().strip())

def li():
	return list(map(int, stdin.readline().split()))

def mp():
	return map(int, stdin.readline().split())

def inp():
	return int(stdin.readline())

def pr(n):
	return stdout.write(str(n) + '\n')
mod = 1000000007
INF = float('inf')

def solve():
	s = set()
	n = inp()
	l = li()
	for i in range(n):
		for j in range(i + 1, n):
			area = (l[j] - l[i]) / 2
			s.add(area)
	pr(len(s))
for _ in range(inp()):
	solve()


t = int(input())
j = 0
while j < t:
	dif = []
	n = int(input())
	cox = list(map(int, input().split()))
	for x in cox:
		i = cox.index(x)
		while i != n - 1:
			dif.append(cox[i + 1] - x)
			i += 1
	d = list(dict.fromkeys(dif))
	print(len(d))
	j += 1


import sys
zz = 1
sys.setrecursionlimit(10 ** 5)
if zz:
	input = sys.stdin.readline
else:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('all.txt', 'w')
di = [[-1, 0], [1, 0], [0, 1], [0, -1]]

def fori(n):
	return [fi() for i in range(n)]

def inc(d, c, x=1):
	d[c] = d[c] + x if c in d else x

def ii():
	return input().rstrip()

def li():
	return [int(xx) for xx in input().split()]

def fli():
	return [float(x) for x in input().split()]

def comp(a, b):
	if a > b:
		return 2
	return 2 if a == b else 0

def gi():
	return [xx for xx in input().split()]

def gtc(tc, ans):
	print('Case #' + str(tc) + ':', ans)

def cil(n, m):
	return n // m + int(n % m > 0)

def fi():
	return int(input())

def pro(a):
	return reduce(lambda a, b: a * b, a)

def swap(a, i, j):
	(a[i], a[j]) = (a[j], a[i])

def si():
	return list(input().rstrip())

def mi():
	return map(int, input().split())

def gh():
	sys.stdout.flush()

def isvalid(i, j, n, m):
	return 0 <= i < n and 0 <= j < m

def bo(i):
	return ord(i) - ord('a')

def graph(n, m):
	for i in range(m):
		(x, y) = mi()
		a[x].append(y)
		a[y].append(x)
t = fi()
uu = t
while t > 0:
	t -= 1
	n = fi()
	a = li()
	s = set()
	for i in range(n):
		for j in range(i + 1, n):
			s.add(abs(a[i] - a[j]))
	print(len(s))


t = int(input())
for _ in range(t):
	n = int(input())
	points = list(map(int, input().split()))
	area = []
	for i in range(n):
		for j in range(n):
			if i != j:
				area.append(0.5 * max(points[i], points[j]) - 0.5 * min(points[i], points[j]))
	print(len(set(area)))


t = int(input())
for e in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	px = []
	for i in l:
		px.append([i, 0])
	p1 = [0, 1]
	d = set()
	for i in range(n):
		for j in range(i + 1, n):
			p2 = px[i]
			p3 = px[j]
			d.add(0.5 * (p1[0] * (p2[1] - p3[1]) + p2[0] * (p3[1] - p1[1]) + p3[0] * (p1[1] - p2[1])))
	c = 0
	for i in d:
		if i != 0:
			c += 1
	print(c)


from __future__ import print_function
from collections import Counter, OrderedDict
from itertools import permutations as perm
from fractions import Fraction
from collections import deque
from sys import stdin
from bisect import *
from heapq import *
import math
g = lambda : stdin.readline().strip()
gl = lambda : g().split()
gil = lambda : [int(var) for var in gl()]
gfl = lambda : [float(var) for var in gl()]
gcl = lambda : list(g())
gbs = lambda : [int(var) for var in g()]
mod = int(1000000000.0) + 7
inf = float('inf')
(t,) = gil()
for _ in range(t):
	(n,) = gil()
	a = gil()
	a.sort()
	ans = set()
	for i in range(n):
		for j in range(i + 1, n):
			ans.add((a[j] - a[i]) / 2)
	print(len(ans))


from math import ceil, gcd
from bisect import bisect_left as bl
from bisect import bisect_right as br
from array import array
from collections import Counter as ctr

def li():
	return list(map(int, input().split()))

def arr(a):
	return array('i', a)

def solve():
	for _ in range(int(input())):
		n = int(input())
		x = li()
		ar = set()
		for i in range(n - 1):
			for j in range(i + 1, n):
				if (x[j] - x[i]) / 2 not in ar:
					ar.add((x[j] - x[i]) / 2)
		print(len(ar))
solve()


t = int(input())
for i in range(t):
	n = int(input())
	x = list(map(int, input().split()))
	diff = []
	for i in range(n):
		for j in range(n):
			if i == j:
				pass
			else:
				diff.append(abs(x[i] - x[j]))
	print(len(set(diff)))


import sys
l = len
s = set
p = input
from itertools import combinations
n = int(p())
for _ in range(n):
	a = p()
	b = list(map(int, p().split()))
	x = l(s([abs(i - j) / 2 for (i, j) in combinations(b, 2)]))
	print(x)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))[:n]
	r = []
	for i in range(len(a)):
		for j in range(i + 1, len(a)):
			area = (a[j] - a[i]) / 2
			if area > 0:
				r.append(area)
	print(len(set(r)))


for u in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	d = set()
	for i in range(n - 1):
		for j in range(i + 1, n):
			s = abs(l[j] - l[i])
			d.add(s)
	print(len(d))


for _ in range(int(input())):
	n = int(input())
	areas = set([])
	values = list(map(int, input().split()))
	for start in range(n - 1):
		for end in range(start + 1, n):
			areas.add(values[end] - values[start])
	print(len(areas))


def solve():
	n = int(input())
	x = list(map(int, input().split()))
	z = [0] * 51
	an = 0
	for i in range(0, len(x)):
		for j in range(i + 1, len(x)):
			if z[x[j] - x[i]] == 0:
				z[x[j] - x[i]] = 1
				an += 1
	print(an)
t = int(input())
for s in range(0, t):
	solve()


t = int(input())

def solve():
	n = int(input())
	x = list(map(int, input().strip().split()))[:n]
	ans = []
	k = 0
	for i in x:
		k += 1
		for j in x[k:]:
			side = j - i
			if side not in ans:
				ans.append(side)
	print(len(ans))
while t > 0:
	solve()
	t -= 1


t = int(input())
while t > 0:
	n = int(input())
	l = [int(x) for x in input().split()]
	m = []
	l.sort()
	for i in range(0, n - 1):
		for j in range(i + 1, n):
			m.append(l[j] - l[i])
	print(len(set(m)))
	t -= 1


s = ''
for i in range(int(input())):
	input()
	a = [int(i) for i in input().split()]
	x = set({})
	for j in range(len(a) - 1):
		for k in range(j + 1, len(a)):
			x.add(abs(a[j] - a[k]) / 2)
	s = s + str(len(x)) + '\n'
print(s)


import math
import random
import heapq, bisect
import sys
from collections import deque, defaultdict
from fractions import Fraction
import sys
from collections import defaultdict
mod = 10 ** 9 + 7
mod1 = 998244353
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class TreeNode:

	def __init__(self, k, v):
		self.key = k
		self.value = v
		self.left = None
		self.right = None
		self.parent = None
		self.height = 1
		self.num_left = 1
		self.num_total = 1

class AvlTree:

	def __init__(self):
		self._tree = None

	def add(self, k, v):
		if not self._tree:
			self._tree = TreeNode(k, v)
			return
		node = self._add(k, v)
		if node:
			self._rebalance(node)

	def _add(self, k, v):
		node = self._tree
		while node:
			if k < node.key:
				if node.left:
					node = node.left
				else:
					node.left = TreeNode(k, v)
					node.left.parent = node
					return node.left
			elif node.key < k:
				if node.right:
					node = node.right
				else:
					node.right = TreeNode(k, v)
					node.right.parent = node
					return node.right
			else:
				node.value = v
				return

	@staticmethod
	def get_height(x):
		return x.height if x else 0

	@staticmethod
	def get_num_total(x):
		return x.num_total if x else 0

	def _rebalance(self, node):
		n = node
		while n:
			lh = self.get_height(n.left)
			rh = self.get_height(n.right)
			n.height = max(lh, rh) + 1
			balance_factor = lh - rh
			n.num_total = 1 + self.get_num_total(n.left) + self.get_num_total(n.right)
			n.num_left = 1 + self.get_num_total(n.left)
			if balance_factor > 1:
				if self.get_height(n.left.left) < self.get_height(n.left.right):
					self._rotate_left(n.left)
				self._rotate_right(n)
			elif balance_factor < -1:
				if self.get_height(n.right.right) < self.get_height(n.right.left):
					self._rotate_right(n.right)
				self._rotate_left(n)
			else:
				n = n.parent

	def _remove_one(self, node):
		replacement = node.left or node.right
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = replacement
			else:
				node.parent.right = replacement
			replacement.parent = node.parent
			node.parent = None
		else:
			self._tree = replacement
			replacement.parent = None
		node.left = None
		node.right = None
		node.parent = None
		self._rebalance(replacement)

	def _remove_leaf(self, node):
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = None
			else:
				node.parent.right = None
			self._rebalance(node.parent)
		else:
			self._tree = None
		node.parent = None
		node.left = None
		node.right = None

	def remove(self, k):
		node = self._get_node(k)
		if not node:
			return
		if AvlTree._is_leaf(node):
			self._remove_leaf(node)
			return
		if node.left and node.right:
			nxt = AvlTree._get_next(node)
			node.key = nxt.key
			node.value = nxt.value
			if self._is_leaf(nxt):
				self._remove_leaf(nxt)
			else:
				self._remove_one(nxt)
			self._rebalance(node)
		else:
			self._remove_one(node)

	def get(self, k):
		node = self._get_node(k)
		return node.value if node else -1

	def _get_node(self, k):
		if not self._tree:
			return None
		node = self._tree
		while node:
			if k < node.key:
				node = node.left
			elif node.key < k:
				node = node.right
			else:
				return node
		return None

	def get_at(self, pos):
		x = pos + 1
		node = self._tree
		while node:
			if x < node.num_left:
				node = node.left
			elif node.num_left < x:
				x -= node.num_left
				node = node.right
			else:
				return (node.key, node.value)
		raise IndexError('Out of ranges')

	@staticmethod
	def _is_left(node):
		return node.parent.left and node.parent.left == node

	@staticmethod
	def _is_leaf(node):
		return node.left is None and node.right is None

	def _rotate_right(self, node):
		if not node.parent:
			self._tree = node.left
			node.left.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.left
			node.left.parent = node.parent
		else:
			node.parent.right = node.left
			node.left.parent = node.parent
		bk = node.left.right
		node.left.right = node
		node.parent = node.left
		node.left = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	def _rotate_left(self, node):
		if not node.parent:
			self._tree = node.right
			node.right.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.right
			node.right.parent = node.parent
		else:
			node.parent.right = node.right
			node.right.parent = node.parent
		bk = node.right.left
		node.right.left = node
		node.parent = node.right
		node.right = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	@staticmethod
	def _get_next(node):
		if not node.right:
			return node.parent
		n = node.right
		while n.left:
			n = n.left
		return n

class SegmentTree1:

	def __init__(self, data, default=300006, func=lambda a, b: min(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class SegmentTree:

	def __init__(self, data, default=0, func=lambda a, b: a + b):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD

def powm(a, n, m):
	if a == 1 or n == 0:
		return 1
	if n % 2 == 0:
		s = powm(a, n // 2, m)
		return s * s % m
	else:
		return a * powm(a, n - 1, m) % m

def sort_list(list1, list2):
	zipped_pairs = zip(list2, list1)
	z = [x for (_, x) in sorted(zipped_pairs)]
	return z

def product(l):
	por = 1
	for i in range(len(l)):
		por *= l[i]
	return por

def binarySearchCount(arr, n, key):
	left = 0
	right = n - 1
	count = 0
	while left <= right:
		mid = int((right + left) / 2)
		if arr[mid] < key:
			count = mid + 1
			left = mid + 1
		else:
			right = mid - 1
	return count

def countdig(n):
	c = 0
	while n > 0:
		n //= 10
		c += 1
	return c

def binary(x, length):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y

def countGreater(arr, n, k):
	l = 0
	r = n - 1
	leftGreater = n
	while l <= r:
		m = int(l + (r - l) / 2)
		if arr[m] >= k:
			leftGreater = m
			r = m - 1
		else:
			l = m + 1
	return n - leftGreater

class TrieNode:

	def __init__(self):
		self.children = [None] * 26
		self.isEndOfWord = False

class Trie:

	def __init__(self):
		self.root = self.getNode()

	def getNode(self):
		return TrieNode()

	def _charToIndex(self, ch):
		return ord(ch) - ord('a')

	def insert(self, key):
		pCrawl = self.root
		length = len(key)
		for level in range(length):
			index = self._charToIndex(key[level])
			if not pCrawl.children[index]:
				pCrawl.children[index] = self.getNode()
			pCrawl = pCrawl.children[index]
		pCrawl.isEndOfWord = True

	def search(self, key):
		pCrawl = self.root
		length = len(key)
		for level in range(length):
			index = self._charToIndex(key[level])
			if not pCrawl.children[index]:
				return False
			pCrawl = pCrawl.children[index]
		return pCrawl != None and pCrawl.isEndOfWord

class Node:

	def __init__(self, data):
		self.data = data
		self.height = 0
		self.left = None
		self.right = None

class BinaryTrie:

	def __init__(self):
		self.root = Node(0)

	def insert(self, pre_xor):
		self.temp = self.root
		for i in range(31, -1, -1):
			val = pre_xor & 1 << i
			if val == 0:
				if not self.temp.right:
					self.temp.right = Node(0)
				self.temp = self.temp.right
			elif val >= 1:
				if not self.temp.left:
					self.temp.left = Node(0)
				self.temp = self.temp.left

	def do(self, temp):
		if not temp:
			return 0
		ter = temp
		temp.height = self.do(ter.left) + self.do(ter.right)
		if temp.height == 0:
			temp.height += 1
		return temp.height

	def query(self, xor):
		self.temp = self.root
		cur = 0
		i = 31
		while i > -1:
			val = xor & 1 << i
			if not self.temp:
				return cur
			if val >= 1:
				self.opp = self.temp.right
				if self.temp.left:
					self.temp = self.temp.left
				else:
					return cur
			else:
				self.opp = self.temp.left
				if self.temp.right:
					self.temp = self.temp.right
				else:
					return cur
			if self.temp.height == pow(2, i):
				cur += 1 << i
				self.temp = self.opp
			i -= 1
		return cur
for ik in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	s = set()
	for i in range(n):
		for j in range(i + 1, n):
			s.add(abs(l[i] - l[j]))
	print(len(s))


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def st():
	return input().rstrip('\n')

def lis():
	return list(map(int, input().split()))

def maa():
	return map(int, input().split())
t = inp()
while t:
	t -= 1
	n = inp()
	a = lis()
	v = set()
	for i in range(n):
		for j in range(i + 1, n):
			x = a[j] - a[i]
			x = x / 2
			v.add(x)
	print(len(v))


def area(x, y, n):
	ar = 0.0
	j = n - 1
	for i in range(0, n):
		ar = ar + (x[j] + x[i]) * (y[i] - y[j])
		j = i
	return ar / 2.0
t = int(input())
for _ in range(t):
	n = int(input())
	x = list(map(int, input().split()))
	a = []
	for i in range(len(x)):
		for j in range(i, n):
			if area([0, x[i], x[j]], [1, 0, 0], 3) != 0:
				a.append(area([0, x[i], x[j]], [1, 0, 0], 3))
	print(len(set(a)))


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	li = set()
	for i in range(n - 1):
		for j in range(i + 1, n):
			li.add(arr[j] - arr[i])
	print(len(li))


n = int(input())
list_of_num = []
list_of_elem = []
my_list = []
for i in range(n):
	count = int(input())
	string_of_elem = str(input())
	list_of_elem = string_of_elem.split(' ')
	if count == '1':
		my_list.append(0)
	elif count == '2':
		my_list.append(1)
	else:
		list_of_square = set()
		for k in range(count):
			help_ = count - 1
			while help_ > 0:
				s = int(list_of_elem[help_]) - int(list_of_elem[k])
				if s > 0:
					list_of_square.add(s)
				help_ -= 1
		my_list.append(len(list_of_square))
print('\n'.join(map(str, my_list)))


import sys
import bisect, string, math, time, functools, random, fractions
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
from itertools import permutations, combinations, groupby
rep = range
R = range

def I():
	return int(input())

def S_():
	return input()

def IS():
	return input().split()

def LS():
	return [i for i in input().split()]

def MI():
	return map(int, input().split())

def LI():
	return [int(i) for i in input().split()]

def LI_():
	return [int(i) - 1 for i in input().split()]

def NI(n):
	return [int(input()) for i in range(n)]

def NI_(n):
	return [int(input()) - 1 for i in range(n)]

def NLI(n):
	return [[int(i) for i in input().split()] for i in range(n)]

def NLI_(n):
	return [[int(i) - 1 for i in input().split()] for i in range(n)]

def StoLI():
	return [ord(i) - 97 for i in input()]

def ItoS(n):
	return chr(n + 97)

def LtoS(ls):
	return ''.join([chr(i + 97) for i in ls])

def RLI(n=8, a=1, b=10):
	return [random.randint(a, b) for i in range(n)]

def RI(a=1, b=10):
	return random.randint(a, b)

def INP():
	N = 9
	n = random.randint(1, N)
	A = [random.randint(1, n) for i in range(m)]
	return (n, A)

def Rtest(T):
	(case, err) = (0, 0)
	for i in range(T):
		inp = INP()
		a1 = naive(*inp)
		a2 = solve(*inp)
		if a1 != a2:
			print(inp)
			print('naive', a1)
			print('solve', a2)
			err += 1
		case += 1
	print('Tested', case, 'case with', err, 'errors')

def GI(V, E, ls=None, Directed=False, index=1):
	org_inp = []
	g = [[] for i in range(V)]
	FromStdin = True if ls == None else False
	for i in range(E):
		if FromStdin:
			inp = LI()
			org_inp.append(inp)
		else:
			inp = ls[i]
		if len(inp) == 2:
			(a, b) = inp
			c = 1
		else:
			(a, b, c) = inp
		if index == 1:
			a -= 1
			b -= 1
		aa = (a, c)
		bb = (b, c)
		g[a].append(bb)
		if not Directed:
			g[b].append(aa)
	return (g, org_inp)

def GGI(h, w, search=None, replacement_of_found='.', mp_def={'#': 1, '.': 0}, boundary=1):
	mp = [boundary] * (w + 2)
	found = {}
	for i in R(h):
		s = input()
		for char in search:
			if char in s:
				found[char] = (i + 1) * (w + 2) + s.index(char) + 1
				mp_def[char] = mp_def[replacement_of_found]
		mp += [boundary] + [mp_def[j] for j in s] + [boundary]
	mp += [boundary] * (w + 2)
	return (h + 2, w + 2, mp, found)

def TI(n):
	return GI(n, n - 1)

def accum(ls):
	rt = [0]
	for i in ls:
		rt += [rt[-1] + i]
	return rt

def bit_combination(n, base=2):
	rt = []
	for tb in R(base ** n):
		s = [tb // base ** bt % base for bt in R(n)]
		rt += [s]
	return rt

def gcd(x, y):
	if y == 0:
		return x
	if x % y == 0:
		return y
	while x % y != 0:
		(x, y) = (y, x % y)
	return y

def YN(x):
	print(['NO', 'YES'][x])

def Yn(x):
	print(['No', 'Yes'][x])

def show(*inp, end='\n'):
	if show_flg:
		print(*inp, end=end)
mo = 10 ** 9 + 7
inf = float('inf')
FourNb = [(-1, 0), (1, 0), (0, 1), (0, -1)]
EightNb = [(-1, 0), (1, 0), (0, 1), (0, -1), (1, 1), (-1, -1), (1, -1), (-1, 1)]
compas = dict(zip('WENS', FourNb))
cursol = dict(zip('LRUD', FourNb))
l_alp = string.ascii_lowercase
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
input = lambda : sys.stdin.readline().rstrip()
show_flg = False
show_flg = True
ans = 0
for _ in range(I()):
	n = I()
	a = LI()
	s = set()
	for i in range(n):
		for j in range(i + 1, n):
			s.add(a[j] - a[i])
	ans = len(s)
	print(ans)


def sol(a):
	s = set()
	for i in range(0, len(a) - 1):
		for j in range(i + 1, len(a)):
			s.add(a[j] - a[i])
	return len(s)
n = int(input())
for i in range(n):
	input()
	a = [int(x) for x in input().split()]
	print(sol(a))


t = int(input())
for test in range(0, t):
	n = int(input())
	arr = list(map(int, input().split(' ')))
	out = []
	for i in range(0, n - 1):
		for j in range(i + 1, n):
			k = abs(arr[i] - arr[j])
			if k not in out:
				out.append(k)
	print(len(out))


for k in range(int(input())):
	a = int(input())
	c = []
	b = list(map(int, input().split()))
	d = b
	for i in range(a - 1, 0, -1):
		for j in range(i - 1, -1, -1):
			if b[i] - b[j] not in c:
				c.append(b[i] - b[j])
	print(len(c))


def solve():
	n_trees = int(input())
	nums = list(map(lambda x: int(x), input().split()))
	areas = set()
	for i in range(len(nums) - 1):
		for j in range(i + 1, len(nums)):
			areas.add(nums[j] - nums[i])
	return f'{len(areas)}'
n = int(input())
for i in range(n):
	result = solve()
	print(result)


for _ in range(int(input())):
	n = int(input())
	(*x,) = map(int, input().split())
	r = set()
	for y in x:
		for z in x:
			r.add(abs(z - y))
	r.discard(0)
	print(len(r))


import sys
input = lambda : sys.stdin.readline().strip()

def get_area(x, y):
	return 0.5 * (x[0] * (y[1] - y[2]) + x[1] * (y[2] - y[0]) + x[2] * (y[0] - y[1]))
t = int(input())
while t:
	t -= 1
	n = int(input())
	xs = list(map(int, input().split()))
	s = set()
	for i in range(n):
		for j in range(i + 1, n):
			area = get_area([0, xs[i], xs[j]], [1, 0, 0])
			s.add(area)
	print(len(s))


cases = int(input())
for case in range(cases):
	n = int(input())
	arveres = list(map(int, input().split(' ')))
	diffs = {}
	for i in range(len(arveres)):
		for j in range(i, len(arveres)):
			diffs[abs(arveres[j] - arveres[i])] = 'pigoca'
	diffs.pop(0, None)
	print(len(diffs))


import sys
input = sys.stdin.readline
from collections import Counter
import math
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	ans = []
	for i in range(n):
		for j in range(i + 1, n):
			ans.append(abs(arr[i] - arr[j]))
	ans = set(ans)
	if 0 in ans:
		ans.remove(0)
	print(len(ans))


import math, re

def fast():
	return list(map(int, input().split()))

def solve():
	n = int(input())
	x = fast()
	ss = []
	for i in x:
		for j in x:
			if i != j and (not abs(i - j) * 0.5 in ss):
				ss.append(abs(i - j) * 0.5)
	print(len(ss))
t = int(input())
for _ in range(t):
	solve()


import math as m
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	s = []
	for a in range(n - 1):
		i = l[a]
		for b in range(a + 1, n):
			j = l[b]
			r = pow(i ** 2 + 1, 0.5)
			theta = m.acos(i / r)
			h = m.sin(theta) * r
			s.append(round(0.5 * (j - i) * h, 2))
	st = set(s)
	print(len(st))


def solution():
	numTrees = int(input())
	trees = list(map(int, input().split()))
	setOfTrees = set()
	for i in range(numTrees):
		for j in range(i + 1, numTrees):
			setOfTrees.add(trees[i] - trees[j])
	print(len(setOfTrees))
t = int(input())
for _ in range(t):
	solution()


for _ in range(int(input())):
	MySet = set()
	N = int(input())
	X = list(map(int, input().split()))
	for i in range(N):
		for j in range(i + 1, N):
			MySet.add(X[j] - X[i])
	print(len(MySet))


t = input()
for test in range(int(t)):
	n = input()
	xs = list(map(int, input().split(' ')))
	diffs = []
	for i in range(len(xs) - 1):
		x0 = xs[i]
		for j in range(len(xs) - 1 - i):
			x1 = xs[j + i + 1]
			diff = x1 - x0
			if diff not in diffs:
				diffs.append(diff)
	print(len(diffs))


t = int(input())
while t:
	t = t - 1
	n = int(input())
	a = list(map(int, input().split()))
	x = [abs(i - j) for i in a for j in a if i != j]
	ans = set(x)
	print(len(ans))


import sys
sys.setrecursionlimit(10 ** 6)

def input():
	return sys.stdin.readline()

def solve():
	ans = 0
	n = int(input())
	a = list(map(int, input().split()))
	s = set([])
	for i in range(n):
		for j in range(i + 1, n):
			s.add(a[j] - a[i])
	print(len(s))
	return

def main():
	testcase = int(input())
	for i in range(testcase):
		solve()
	return
main()


t = int(input())
while t:
	n = int(input())
	s = input()
	l = s.split(' ')
	for i in range(n):
		l[i] = int(l[i])
	uni = set()
	for i in range(n):
		for j in range(i + 1, n):
			uni.add(l[j] - l[i])
	print(len(uni))
	t -= 1


T = int(input())
for i in range(T):
	n = int(input())
	l = list(map(int, input().split(' ')))
	s = set()
	for i in range(n - 1):
		for j in range(i + 1, n):
			a1 = 0.5 * (l[j] - l[i])
			a2 = 0.5 * (l[-1] - l[j])
			if a1 != a2 and (a1 != 0 and a2 != 0):
				s.add(a1)
				s.add(a2)
			elif a1 != a2 and (a1 == 0 and a2 != 0):
				s.add(a2)
			elif a1 != a2 and (a1 != 0 and a2 == 0):
				s.add(a1)
	print(len(s))


import sys

def get_ints():
	return list(map(int, sys.stdin.readline().strip().split()))

def area(a, b):
	x1 = 0
	y1 = 1
	x2 = a
	y2 = 0
	x3 = b
	y3 = 0
	gg = 1 / 2 * (x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2))
	return gg
testcases = int(input())
for testcase in range(testcases):
	n = int(input())
	arr = get_ints()
	if n == 2:
		print(1)
		continue
	if n == 1:
		print(0)
		continue
	dicts = {}
	for i in range(n - 1):
		for j in range(i + 1, n):
			val = area(arr[i], arr[j])
			if val not in dicts:
				dicts[val] = 1
	print(len(dicts))


for _ in range(int(input())):
	n = int(input())
	x = list(map(int, input().split()))
	cnt = []
	for i in range(n):
		for j in range(i + 1, n):
			cnt.append(x[j] - x[i])
	k = set(cnt)
	print(len(k))


test = int(input())
while test > 0:
	test -= 1
	n = int(input())
	lst = list(map(int, input().split()))
	tranf = {}
	rs = 0
	for i in range(n):
		for j in range(i + 1, n):
			if (lst[j] - lst[i] in tranf) == False:
				tranf[lst[j] - lst[i]] = 1
				rs += 1
	print(rs)


t = int(input())
while t > 0:
	n = int(input())
	arr = list(map(int, input().split()))
	s = set()
	for i in range(len(arr) - 1):
		for j in range(i, len(arr)):
			diff = abs(arr[j] - arr[i])
			s.add(diff)
	if 0 in s:
		s.remove(0)
	if len(s) > 0:
		print(len(list(s)))
	else:
		print(0)
	t -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	count = [False] * 51
	for i in range(n - 1):
		for j in range(i + 1, n):
			if not count[a[j] - a[i]]:
				count[a[j] - a[i]] = True
	ans = sum(count)
	print(ans)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	b = []
	for i in range(n):
		for j in range(i + 1, n):
			b.append(abs(a[i] - a[j]))
	print(len(set(b)))


t = int(input())
for _ in range(t):
	n = int(input())
	x = list(map(int, input().split()))
	s = set()
	for i in range(0, n - 1):
		for j in range(i + 1, n):
			s.add(x[j] - x[i])
	print(len(s))


from itertools import combinations
t = int(input())
while t > 0:
	n = int(input())
	lst = list(map(int, input().split()))
	area = []
	main = []
	area = list(combinations(lst, 2))
	for i in area:
		main.append(abs(i[0] - i[1]))
	main = set(main)
	print(len(main))
	t -= 1


for _ in range(0, int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	op = []
	for i in range(0, n):
		for j in range(i + 1, n):
			op.append(a[j] - a[i])
	print(len(set(op)))


t = int(input())
for _ in range(t):
	n = int(input())
	lst = input().split()
	lst = [int(i) for i in lst]
	st = set()
	for i in range(n):
		for j in range(i + 1, n):
			st.add(lst[j] - lst[i])
	print(len(st))


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	answers = []
	for i in range(n):
		for j in range(i + 1, n):
			answers.append(0.5 * abs(a[j] - a[i]))
	print(len(set(answers)))


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	c = {}
	for i in range(n):
		for j in range(i + 1, n):
			c[a[j] - a[i]] = 1
	print(len(c))


def func():
	t = int(input())
	for _ in range(t):
		n = int(input())
		point = list(map(int, input().strip().split()))
		distance = []
		for i in range(n - 1):
			for j in range(i + 1, n):
				distance.append(abs(point[i] - point[j]))
		print(len(set(distance)))
func()


for s in [*open(0)][2::2]:
	l = [*map(int, s.split())]
	print(len({abs(i - j) for i in l for j in l if i != j}))


import itertools
t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	a = list(itertools.combinations(l, 2))
	s = set()
	for ele in a:
		s.add(ele[1] - ele[0])
	print(len(s))


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	x = int(input())
	y = list(map(int, input().split()))
	z = []
	for i in range(x - 1):
		for j in range(i + 1, x):
			z.append(abs(y[i] - y[j]))
	print(len(list(set(z))))


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	aux = []
	for k in range(n - 1):
		for j in range(k + 1, n):
			x = l[j] - l[k]
			if x not in aux:
				aux.append(x)
	print(len(aux))


import sys
import bisect
import math

def get_line():
	return list(map(int, sys.stdin.readline().strip().split()))

def in1():
	return int(input())
for _ in range(in1()):
	n = in1()
	a = get_line()
	a.sort()
	d = {}
	for i in range(n):
		for j in range(i + 1, n):
			t1 = a[j] - a[i]
			if t1 not in d.keys():
				d[t1] = 0
	print(len(d))


import sys

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def map_string():
	return map(str, sys.stdin.readline().strip().split())

def get_string():
	return sys.stdin.readline().strip()
t = int(get_string())
for _ in range(t):
	n = int(get_string())
	arr = list(get_ints())
	my_set = set()
	step = 1
	while step != n:
		for i in range(step, n, 1):
			my_set.add(arr[i] - arr[i - step])
		step += 1
	print(len(my_set))


int_line = lambda : list(map(int, input().strip().split()))
int_inp = lambda : int(input())

def uttar(a):
	n = len(a)
	diff = set()
	for i in range(n - 1):
		for j in range(i + 1, n):
			diff.add(abs(a[i] - a[j]))
	print(len(diff))
for _ in range(int_inp()):
	n = int_inp()
	a = int_line()
	uttar(a)


t = int(input())
for _ in range(t):
	n = int(input())
	xs = [int(i) for i in input().split()]
	areas = set()
	for i in range(0, len(xs)):
		for j in range(i + 1, len(xs)):
			area = (xs[j] - xs[i]) / 2
			areas.add(area)
	print(len(areas))


t = int(input())
for _ in range(t):
	n = int(input())
	x = [int(x) for x in input().split()]
	a = set()
	for i in range(n):
		for j in range(n):
			a.add(abs(x[i] - x[j]))
	print(len(a) - 1)


for i in range(int(input())):
	x = int(input())
	arr = [int(i) for i in input().split()]
	b = set()
	for ele in arr:
		for k in range(x):
			if abs(ele - arr[k]) not in b:
				b.add(abs(ele - arr[k]))
	print(len(b) - 1)


tests = int(input())
while tests:
	tests -= 1
	n = int(input())
	sp = list(map(int, input().split()))
	s = set()
	for i in range(n - 1):
		for j in range(i + 1, n):
			sf = (sp[j] - 1) * 1 / 2 - sp[i] * 1 / 2
			s.add(sf)
	print(len(s))


for _ in range(int(input())):
	n = int(input())
	x = [int(x) for x in input().split()]
	areas = []
	for i in range(n):
		small = x[i] / 2
		for j in range(i + 1, n):
			big = x[j] / 2
			areas.append(big - small)
	print(len(set(areas)))


t = int(input())

def solve(xs):
	areas = []
	for i in range(0, len(xs)):
		for j in range(0, i):
			areas.append(xs[i] - xs[j])
	areas = set(areas)
	return len(areas)
for i in range(0, t):
	n = int(input())
	xs = [int(x) for x in input().split(' ')]
	print(solve(xs))


t = int(input())
for _ in range(0, t):
	n = int(input())
	x = list(map(int, input().split()))
	l = len(x)
	b = []
	for i in range(l - 1, 0, -1):
		for j in range(0, i):
			b.append(x[i] - x[j])
	b = set(b)
	print(len(b))


t = int(input())
for i in range(t):
	n = int(input())
	points = [int(x) for x in input().split()]
	area = []
	a = n * (n - 1) / 2
	co = 0
	for i in range(n - 1):
		for j in range(i + 1, n):
			p = points[j] - points[i]
			if p not in area:
				area.append(p)
				co += 1
	print(co)


from itertools import combinations
for _ in range(int(input())):
	n = int(input())
	x = list(map(int, input().split()))
	c = combinations(x, 2)
	ans = set()
	for i in c:
		ans.add(i[1] - i[0])
	print(len(ans))


for t in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	c = 0
	d = {}
	for i in range(n - 1):
		for j in range(i + 1, n):
			if l[j] - l[i] not in d:
				d[l[j] - l[i]] = 1
				c += 1
	print(c)