Buggy python submission (verdict: Time Limit Exceeded):
num=int(input())
stl =[''.join(sorted(input())) for i in range(num)]

duplicate=[x for x in set(stl) if stl.count(x) > 1]

count=0

for dup in duplicate:
    n=stl.count(dup)
    count += n*(n-1) // 2
print(count)

Fixed submission:
num=int(input())
stl =[''.join(sorted(input())) for i in range(num)]

#duplicate=[x for x in set(stl) if stl.count(x) > 1]

t = {}
for i in range(num):
  if stl[i] in t:
    t[stl[i]] += 1
  else:
    t[stl[i]] = 1
print(sum(t[k] * (t[k] -1) // 2 for k in t))

Buggy python submission (verdict: Time Limit Exceeded):
from math import factorial
import sys

input=sys.stdin.readline

num=int(input())
#stl =[''.join(sorted(input())) for i in range(num)]
stl =[input() for i in range(num)]
stl =[''.join(sorted(i)) for i in stl]

duplicate=[x for x in set(stl) if stl.count(x) > 1]

count=0

for dup in duplicate:
    n=stl.count(dup)
    count += factorial(n) // 2 // factorial(n - 2)
print(count)

Fixed submission:
num=int(input())
stl =[''.join(sorted(input())) for i in range(num)]

#duplicate=[x for x in set(stl) if stl.count(x) > 1]

t = {}
for i in range(num):
  if stl[i] in t:
    t[stl[i]] += 1
  else:
    t[stl[i]] = 1
print(sum(t[k] * (t[k] -1) // 2 for k in t))

Buggy python submission (verdict: Time Limit Exceeded):
from math import factorial
import sys

input=sys.stdin.readline

num=int(input())
stl =[''.join(sorted(input())) for i in range(num)]

duplicate=[x for x in set(stl) if stl.count(x) > 1]

count=0

for dup in duplicate:
    n=stl.count(dup)
    count += factorial(n) // 2 // factorial(n - 2)
print(count)

Fixed submission:
num=int(input())
stl =[''.join(sorted(input())) for i in range(num)]

#duplicate=[x for x in set(stl) if stl.count(x) > 1]

t = {}
for i in range(num):
  if stl[i] in t:
    t[stl[i]] += 1
  else:
    t[stl[i]] = 1
print(sum(t[k] * (t[k] -1) // 2 for k in t))

Buggy python submission (verdict: Time Limit Exceeded):
from math import factorial

num=int(input())
stl =[''.join(sorted(input())) for i in range(num)]

duplicate=[x for x in set(stl) if stl.count(x) > 1]

count=0

for dup in duplicate:
    n=stl.count(dup)
    count += factorial(n) // 2 // factorial(n - 2)
print(count)

Fixed submission:
num=int(input())
stl =[''.join(sorted(input())) for i in range(num)]

#duplicate=[x for x in set(stl) if stl.count(x) > 1]

t = {}
for i in range(num):
  if stl[i] in t:
    t[stl[i]] += 1
  else:
    t[stl[i]] = 1
print(sum(t[k] * (t[k] -1) // 2 for k in t))

Buggy python submission (verdict: Time Limit Exceeded):
from math import factorial
import sys

input=sys.stdin.readline

num=int(input())
stl =[''.join(sorted(input())) for i in range(num)]

duplicate=[x for x in set(stl) if stl.count(x) > 1]

count=0

for dup in duplicate:
    count += factorial(stl.count(dup)) // 2 // factorial(stl.count(dup) - 2)
print(count)

Fixed submission:
num=int(input())
stl =[''.join(sorted(input())) for i in range(num)]

#duplicate=[x for x in set(stl) if stl.count(x) > 1]

t = {}
for i in range(num):
  if stl[i] in t:
    t[stl[i]] += 1
  else:
    t[stl[i]] = 1
print(sum(t[k] * (t[k] -1) // 2 for k in t))

Buggy python submission (verdict: Time Limit Exceeded):
from math import factorial

num=int(input())

#for i in range(num):
#    str=input()
#    str=''.join(sorted(str))
#    str = ''.join(sorted(input()))
#    stl.append(str)
stl =[(''.join(sorted(input()))) for i in range(num)]

duplicate=[x for x in set(stl) if stl.count(x) > 1]
count=0

for dup in duplicate:
    count += factorial(stl.count(dup)) // 2 // factorial(stl.count(dup) - 2)
    
print(count)

Fixed submission:
num=int(input())
stl =[''.join(sorted(input())) for i in range(num)]

#duplicate=[x for x in set(stl) if stl.count(x) > 1]

t = {}
for i in range(num):
  if stl[i] in t:
    t[stl[i]] += 1
  else:
    t[stl[i]] = 1
print(sum(t[k] * (t[k] -1) // 2 for k in t))

Buggy python submission (verdict: Time Limit Exceeded):
from math import factorial

num=int(input())
count=0

#for i in range(num):
#    str=input()
#    str=''.join(sorted(str))
#    str = ''.join(sorted(input()))
#    stl.append(str)
stl =[(''.join(sorted(input()))) for i in range(num)]

duplicate=[x for x in set(stl) if stl.count(x) > 1]
if duplicate:
    for dup in duplicate:
        n=stl.count(dup)
        count += factorial(n) // 2 // factorial(n - 2)
    
print(count)

Fixed submission:
num=int(input())
stl =[''.join(sorted(input())) for i in range(num)]

#duplicate=[x for x in set(stl) if stl.count(x) > 1]

t = {}
for i in range(num):
  if stl[i] in t:
    t[stl[i]] += 1
  else:
    t[stl[i]] = 1
print(sum(t[k] * (t[k] -1) // 2 for k in t))

Buggy python submission (verdict: Time Limit Exceeded):
from math import factorial

num=int(input())
stl=[]

count=0

for i in range(num):
    str=input()
    str=''.join(sorted(str))
    stl.append(str)

duplicate=[x for x in set(stl) if stl.count(x) > 1]
if duplicate:
    for dup in duplicate:
        count=count+factorial(stl.count(dup)) // factorial(2) // factorial(stl.count(dup) - 2)

    
print(count)

Fixed submission:
num=int(input())
stl =[''.join(sorted(input())) for i in range(num)]

#duplicate=[x for x in set(stl) if stl.count(x) > 1]

t = {}
for i in range(num):
  if stl[i] in t:
    t[stl[i]] += 1
  else:
    t[stl[i]] = 1
print(sum(t[k] * (t[k] -1) // 2 for k in t))

Buggy python submission (verdict: Time Limit Exceeded):
from math import factorial

num=int(input())
stl=[]

count=0

for i in range(num):
    str=input()
    stll=list(str)
    stll.sort()
    str=''.join(stll)        
    stl.append(str)

duplicate=[x for x in set(stl) if stl.count(x) > 1]
if duplicate:
    for dup in duplicate:
        n=stl.count(dup)
        count=count+factorial(n) // factorial(2) // factorial(n - 2)

    
print(count)

Fixed submission:
num=int(input())
stl =[''.join(sorted(input())) for i in range(num)]

#duplicate=[x for x in set(stl) if stl.count(x) > 1]

t = {}
for i in range(num):
  if stl[i] in t:
    t[stl[i]] += 1
  else:
    t[stl[i]] = 1
print(sum(t[k] * (t[k] -1) // 2 for k in t))