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