def f(x):

    return 10 ** (ord(x) - ord('a') + 1)





import math





def combinations_count(n, r):

    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))





from collections import Counter



N = int(eval(input()))

counter = Counter()

for i in range(N):

    counter[sum([f(i) for i in eval(input())])] += 1

res = 0

for v in list(counter.values()):

    if v > 1:

        res += combinations_count(v, 2)

print(res)
from collections import Counter



N = int(eval(input()))

counter = Counter()

for i in range(N):

    counter[tuple(sorted(eval(input())))] += 1



res = 0

for v in list(counter.values()):

    res += v * (v - 1) / 2



print((int(res)))
def f(x):
    return 10 ** (ord(x) - ord("a") + 1)


import math


def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


from collections import Counter

N = int(eval(input()))
counter = Counter()
for i in range(N):
    counter[sum([f(i) for i in eval(input())])] += 1
res = 0
for v in list(counter.values()):
    if v > 1:
        res += combinations_count(v, 2)
print(res)

from collections import Counter

N = int(eval(input()))
counter = Counter()
for i in range(N):
    counter[tuple(sorted(eval(input())))] += 1
res = 0
for v in list(counter.values()):
    res += v * (v - 1) / 2
print((int(res)))

-def f(x): -    return 10 ** (ord(x) - ord("a") + 1) - - -import math - - -def combinations_count(n, r): -    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r)) - - -    counter[sum([f(i) for i in eval(input())])] += 1 +    counter[tuple(sorted(eval(input())))] += 1 -    if v > 1: -        res += combinations_count(v, 2) -print(res) +    res += v * (v - 1) / 2 +print((int(res)))