n = int(input()) s = [input() for _ in range(n)] t = set() for i in range(n): for j in range(i): t.add(s[i] + s[j]) t.add(s[j] + s[i]) print(len(t))