import collections

N = int(eval(input()))

A = []

for i in range(N):

    s = sorted(eval(input()))

    A.append(str(s))

B = collections.Counter(A)

print((sum(i*(i-1)//2 for i in list(B.values()))))
import collections

N = int(eval(input()))

s = ["".join(sorted(eval(input()))) for _ in range(N)]

B = collections.Counter(s)

print((sum(i*(i-1)//2 for i in list(B.values()))))
import collections

N = int(eval(input()))
A = []
for i in range(N):
    s = sorted(eval(input()))
    A.append(str(s))
B = collections.Counter(A)
print((sum(i * (i - 1) // 2 for i in list(B.values()))))

import collections

N = int(eval(input()))
s = ["".join(sorted(eval(input()))) for _ in range(N)]
B = collections.Counter(s)
print((sum(i * (i - 1) // 2 for i in list(B.values()))))

-A = [] -for i in range(N): -    s = sorted(eval(input())) -    A.append(str(s)) -B = collections.Counter(A) +s = ["".join(sorted(eval(input()))) for _ in range(N)] +B = collections.Counter(s)