n=int(eval(input()))

s=[]

for i in range(n):

  s.append("".join(sorted(eval(input()))))

#sss=set(s)

ans=0

import collections

c=collections.Counter(s)



for l in list(c.values()):

  ans+=l*(l-1)*(1/2)

print((int(ans)))

from collections import defaultdict

d=defaultdict(int)

n,*s=open(0).read().split()

for i in s:d["".join(sorted(list(i)))]+=1

print((sum(v*(v-1)//2 for v in list(d.values()))))
n = int(eval(input()))
s = []
for i in range(n):
    s.append("".join(sorted(eval(input()))))
# sss=set(s)
ans = 0
import collections

c = collections.Counter(s)
for l in list(c.values()):
    ans += l * (l - 1) * (1 / 2)
print((int(ans)))

from collections import defaultdict

d = defaultdict(int)
n, *s = open(0).read().split()
for i in s:
    d["".join(sorted(list(i)))] += 1
print((sum(v * (v - 1) // 2 for v in list(d.values()))))

-n = int(eval(input())) -s = [] -for i in range(n): -    s.append("".join(sorted(eval(input())))) -# sss=set(s) -ans = 0 -import collections +from collections import defaultdict -c = collections.Counter(s) -for l in list(c.values()): -    ans += l * (l - 1) * (1 / 2) -print((int(ans))) +d = defaultdict(int) +n, *s = open(0).read().split() +for i in s: +    d["".join(sorted(list(i)))] += 1 +print((sum(v * (v - 1) // 2 for v in list(d.values()))))