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