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