import itertools N = int(input()) S = [] for N in range(N): S.append(input()) lst = [] for i in itertools.combinations(S, r=2): lst.append(i[0]+i[1]) lst.append(i[1]+i[0]) ans = len(set(lst)) print(ans)