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