P=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101]

n=int(eval(input()))

A=[1]*n



for i in range(n):

	s=eval(input())

	for j in range(10):

		A[i] *= P[ord(s[j])-97]



res=0

A.sort()

cnt=0



for i in range(n-1):

		if A[i]==A[i+1]:

			cnt += 1

		else:

			res += cnt*(cnt+1)//2

			cnt=0

if cnt != 0:

	res += cnt*(cnt+1)//2

print(res)
import collections

n=int(eval(input()))

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

v=list(s.values())

res=0

for u in v:

	if u!=1:

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

print(res)
P = [
    2,
    3,
    5,
    7,
    11,
    13,
    17,
    19,
    23,
    29,
    31,
    37,
    41,
    43,
    47,
    53,
    59,
    61,
    67,
    71,
    73,
    79,
    83,
    89,
    97,
    101,
]
n = int(eval(input()))
A = [1] * n
for i in range(n):
    s = eval(input())
    for j in range(10):
        A[i] *= P[ord(s[j]) - 97]
res = 0
A.sort()
cnt = 0
for i in range(n - 1):
    if A[i] == A[i + 1]:
        cnt += 1
    else:
        res += cnt * (cnt + 1) // 2
        cnt = 0
if cnt != 0:
    res += cnt * (cnt + 1) // 2
print(res)

import collections

n = int(eval(input()))
s = collections.Counter(["".join(sorted(eval(input()))) for _ in range(n)])
v = list(s.values())
res = 0
for u in v:
    if u != 1:
        res += u * (u - 1) // 2
print(res)

-P = [ -    2, -    3, -    5, -    7, -    11, -    13, -    17, -    19, -    23, -    29, -    31, -    37, -    41, -    43, -    47, -    53, -    59, -    61, -    67, -    71, -    73, -    79, -    83, -    89, -    97, -    101, -] +import collections + -A = [1] * n -for i in range(n): -    s = eval(input()) -    for j in range(10): -        A[i] *= P[ord(s[j]) - 97] +s = collections.Counter(["".join(sorted(eval(input()))) for _ in range(n)]) +v = list(s.values()) -A.sort() -cnt = 0 -for i in range(n - 1): -    if A[i] == A[i + 1]: -        cnt += 1 -    else: -        res += cnt * (cnt + 1) // 2 -        cnt = 0 -if cnt != 0: -    res += cnt * (cnt + 1) // 2 +for u in v: +    if u != 1: +        res += u * (u - 1) // 2