Buggy python submission (verdict: Time Limit Exceeded):
#python3
import collections as col
n=int(input())
a=[input() for i in range(n)]

b=col.defaultdict(int)
for i in a:
  b[''.join(sorted(i))]+=1


c = [''.join(sorted(a)) for _ in range(n)]
#print(sum2)

sum1=0
for i in b.values():
  sum1+=i*(i-1)//2
print(sum1)







Fixed submission:
#python3
n = int(input())
s = [str(input()) for _ in range(n)]
sep = ''
dic = dict()
for string in s:
  tmp = sep.join(sorted(string))
  if tmp in dic:
    dic[tmp] += 1 
  else :
    dic[tmp] = 1
ans = 0
for i in dic.values(): 
  ans += i*(i-1)//2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
#python3
import collections as col
n=int(input())
a=[input() for i in range(n)]

b=col.defaultdict(int)
for i in a:
  b[''.join(sorted(i))]+=1


c = [''.join(sorted(a)) for _ in range(n)]
d = {string: a.count(string) for string in a}
#print(sum2)

sum1=0
for i in b.values():
  sum1+=i*(i-1)//2
print(sum1)







Fixed submission:
#python3
n = int(input())
s = [str(input()) for _ in range(n)]
sep = ''
dic = dict()
for string in s:
  tmp = sep.join(sorted(string))
  if tmp in dic:
    dic[tmp] += 1 
  else :
    dic[tmp] = 1
ans = 0
for i in dic.values(): 
  ans += i*(i-1)//2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
#python3
import collections as col
n=int(input())
a=[input() for i in range(n)]

b=col.defaultdict(int)
for i in a:
  b[''.join(sorted(i))]+=1


c = [''.join(sorted(a)) for _ in range(n)]
d = {string: a.count(string) for string in a}
sum2=0
for i in d.values():
  sum2+=i*(i-1)//2 
#print(sum2)

sum1=0
for i in b.values():
  sum1+=i*(i-1)//2
print(sum1)







Fixed submission:
#python3
n = int(input())
s = [str(input()) for _ in range(n)]
sep = ''
dic = dict()
for string in s:
  tmp = sep.join(sorted(string))
  if tmp in dic:
    dic[tmp] += 1 
  else :
    dic[tmp] = 1
ans = 0
for i in dic.values(): 
  ans += i*(i-1)//2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
#python3
n = int(input())
a = [''.join(sorted(input())) for _ in range(n)]
d = {string: a.count(string) for string in a}
sum=0
for i in d.values():
  sum+=i*(i-1)//2 
print(sum)

Fixed submission:
#python3
n = int(input())
s = [str(input()) for _ in range(n)]
sep = ''
dic = dict()
for string in s:
  tmp = sep.join(sorted(string))
  if tmp in dic:
    dic[tmp] += 1 
  else :
    dic[tmp] = 1
ans = 0
for i in dic.values(): 
  ans += i*(i-1)//2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):

n = int(input())
a = [input() for _ in range(n)]
sep=''
b = [sep.join(sorted(a[i])) for i in range(n)]
dic = {letters: b.count(letters) for letters in set(b)}

ans=0
for i in dic.values():
  ans+=i*(i-1)//2
print(ans)

Fixed submission:
#python3
n = int(input())
s = [str(input()) for _ in range(n)]
sep = ''
dic = dict()
for string in s:
  tmp = sep.join(sorted(string))
  if tmp in dic:
    dic[tmp] += 1 
  else :
    dic[tmp] = 1
ans = 0
for i in dic.values(): 
  ans += i*(i-1)//2
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [input() for _ in range(n)]
sep=''
b = [sep.join(sorted(a[i])) for i in range(n)]
dic = {letters: b.count(letters) for letters in set(b)}

ans=0
for i in dic.values():
  ans+=i*(i-1)//2
print(ans

Fixed submission:
#python3
n = int(input())
s = [str(input()) for _ in range(n)]
sep = ''
dic = dict()
for string in s:
  tmp = sep.join(sorted(string))
  if tmp in dic:
    dic[tmp] += 1 
  else :
    dic[tmp] = 1
ans = 0
for i in dic.values(): 
  ans += i*(i-1)//2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
#python3
n = int(input())
a = [input() for _ in range(n)]
sep=''
b = [sep.join(sorted(a[i])) for i in range(n)]
dic = {letters: b.count(letters) for letters in set(b)}

ans=0
for i in dic.values():
  ans+=i*(i-1)//2
print(ans)

Fixed submission:
#python3
n = int(input())
s = [str(input()) for _ in range(n)]
sep = ''
dic = dict()
for string in s:
  tmp = sep.join(sorted(string))
  if tmp in dic:
    dic[tmp] += 1 
  else :
    dic[tmp] = 1
ans = 0
for i in dic.values(): 
  ans += i*(i-1)//2
print(ans)