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