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