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