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