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