N = int(input()) S = [input() for i in range(N)] T = set() for i in range(N): for j in range(N): s = S[i] + S[j] if i != j: T.add(s) print(len(T))