N = int(input())
S = [input() for _ in range(N)]

s = set()
for i in range(N):
	a = S[i]
	for j in range(i + 1,N):
		b = S[j]
		s.add(a + b)
		s.add(b + a)
print(len(s))