n=int(input())
s=[input() for i in range(n)]
g = set()
for i in range(n):
	for j in range(n):
		if i == j: continue
		g.add(s[i]+s[j])
print(len(g))