import math



N = int(eval(input()))

s = [[""]*10 for i in range(N)]

a =[[0]*26 for i in range(N)]

b =[""]*N



cn =ord("a")



for i in range(N):

    s[i] = list(eval(input()))

    s[i].sort()

    b[i] ="".join(s[i])



b.sort()

c = 0

ans =0



for i in range(N-1):

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

        c +=1

    else:

        if c !=0:

            ans=ans + math.factorial(c+1)/(math.factorial(2)*math.factorial(c+1-2))

            c = 0





if c !=0:

    ans = ans + math.factorial(c+1)/(math.factorial(2)*math.factorial(c+1-2))

    



print((int(ans)))

import math

 

N = int(eval(input()))



b =[""]*N

 

cn =ord("a")

 

for i in range(N):

    s = list(eval(input()))

    s.sort()

    b[i] ="".join(s)

 

b.sort()

c = 0

ans =0

 

for i in range(N-1):

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

        c +=1

    else:

        if c !=0:

            ans=ans + math.factorial(c+1)/(math.factorial(2)*math.factorial(c+1-2))

            c = 0

 

 

if c !=0:

    ans = ans + math.factorial(c+1)/(math.factorial(2)*math.factorial(c+1-2))

    

 

print((int(ans)))

import math

N = int(eval(input()))
s = [[""] * 10 for i in range(N)]
a = [[0] * 26 for i in range(N)]
b = [""] * N
cn = ord("a")
for i in range(N):
    s[i] = list(eval(input()))
    s[i].sort()
    b[i] = "".join(s[i])
b.sort()
c = 0
ans = 0
for i in range(N - 1):
    if b[i] == b[i + 1]:
        c += 1
    else:
        if c != 0:
            ans = ans + math.factorial(c + 1) / (
                math.factorial(2) * math.factorial(c + 1 - 2)
            )
            c = 0
if c != 0:
    ans = ans + math.factorial(c + 1) / (math.factorial(2) * math.factorial(c + 1 - 2))
print((int(ans)))

import math

N = int(eval(input()))
b = [""] * N
cn = ord("a")
for i in range(N):
    s = list(eval(input()))
    s.sort()
    b[i] = "".join(s)
b.sort()
c = 0
ans = 0
for i in range(N - 1):
    if b[i] == b[i + 1]:
        c += 1
    else:
        if c != 0:
            ans = ans + math.factorial(c + 1) / (
                math.factorial(2) * math.factorial(c + 1 - 2)
            )
            c = 0
if c != 0:
    ans = ans + math.factorial(c + 1) / (math.factorial(2) * math.factorial(c + 1 - 2))
print((int(ans)))

-s = [[""] * 10 for i in range(N)] -a = [[0] * 26 for i in range(N)] -    s[i] = list(eval(input())) -    s[i].sort() -    b[i] = "".join(s[i]) +    s = list(eval(input())) +    s.sort() +    b[i] = "".join(s)