n = int(input()) s = [] st = set() for _ in range(n): si = input() for sj in s: st.add(si + sj) st.add(sj + si) s.append(si) print(len(st))