Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# Your code here!
#import collections
#import sys
 
#input=sys.stdin.readline
 
N=int(input())
l=[]
clist=[]
 
for i in range(N):
    l.append(list(input()))
    l[i].sort()
    l[i]="".join(l[i])
    #clist.append(collections.Counter(list(input().replace("\n",""))))#ここは普通に入れてfor文でcounterする
 
count=0
 
for i in range(N):
    for j in range(i+1,N):
        if l[i]==l[j]:
            count+=1
            
print(count)

Fixed submission:
# coding: utf-8
# Your code here!
import collections 
 
N=int(input())
l=[]
 
for i in range(N):
    l.append(list(input()))
    l[i].sort()
    l[i]="".join(l[i])
    
clist=list(collections.Counter(l).values())

count=0
for c in clist:
    count+=int(c*(c-1)//2)
    
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# Your code here!
#import collections
#import sys
 
#input=sys.stdin.readline
 
N=int(input())
l=[]
 
for i in range(N):
    l.append(list(input()))
    l[i].sort()
    #clist.append(collections.Counter(list(input().replace("\n",""))))#ここは普通に入れてfor文でcounterする
 
count=0
 
for i in range(N):
    for j in range(i+1,N):
        if l[i]==l[j]:
            count+=1
            
print(count)

Fixed submission:
# coding: utf-8
# Your code here!
import collections 
 
N=int(input())
l=[]
 
for i in range(N):
    l.append(list(input()))
    l[i].sort()
    l[i]="".join(l[i])
    
clist=list(collections.Counter(l).values())

count=0
for c in clist:
    count+=int(c*(c-1)//2)
    
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# Your code here!
import collections
import sys
 
input=sys.stdin.readline
 
N=int(input())
l=[]
clist=[]
 
for i in range(N):
    l.append(list(input().replace("\n","")))
    l[i]=collections.Counter(l[-1])
    #clist.append(collections.Counter(list(input().replace("\n",""))))#ここは普通に入れてfor文でcounterする
 
count=0
 
for i in range(N):
    for j in range(i+1,N):
        if l[i]==l[j]:
            count+=1
            
print(count)

Fixed submission:
# coding: utf-8
# Your code here!
import collections 
 
N=int(input())
l=[]
 
for i in range(N):
    l.append(list(input()))
    l[i].sort()
    l[i]="".join(l[i])
    
clist=list(collections.Counter(l).values())

count=0
for c in clist:
    count+=int(c*(c-1)//2)
    
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# Your code here!
import collections
import sys
 
input=sys.stdin.readline
 
N=int(input())
l=[]
clist=[]
 
for i in range(N):
    l.append(list(input().replace("\n","")))
    clist.append(collections.Counter(l[-1]))
    #clist.append(collections.Counter(list(input().replace("\n",""))))#ここは普通に入れてfor文でcounterする
 
count=0
 
for i in range(N):
    for j in range(i+1,N):
        if clist[i]==clist[j]:
            count+=1
            
print(count)

Fixed submission:
# coding: utf-8
# Your code here!
import collections 
 
N=int(input())
l=[]
 
for i in range(N):
    l.append(list(input()))
    l[i].sort()
    l[i]="".join(l[i])
    
clist=list(collections.Counter(l).values())

count=0
for c in clist:
    count+=int(c*(c-1)//2)
    
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# Your code here!
import collections
import sys

input=sys.stdin.readline

N=int(input())
l=[]
clist=[]

for i in range(N):
    clist.append(collections.Counter(list(input().replace("\n",""))))#ここは普通に入れてfor文でcounterする

count=0

for i in range(N):
    for j in range(i+1,N):
        if clist[i]==clist[j]:
            count+=1
            
print(count)
        


Fixed submission:
# coding: utf-8
# Your code here!
import collections 
 
N=int(input())
l=[]
 
for i in range(N):
    l.append(list(input()))
    l[i].sort()
    l[i]="".join(l[i])
    
clist=list(collections.Counter(l).values())

count=0
for c in clist:
    count+=int(c*(c-1)//2)
    
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# Your code here!
import collections
import sys

input=sys.stdin.readline

N=int(input())
l=[]
clist=[]

for i in range(N):
    clist.append(collections.Counter(list(input().replace("\n",""))))#ここは普通に入れてfor文でcounterする

count=0

for i in range(N):
    for j in range(i+1,N):
        if clist[i]==clist[j]:
            count+=1
            
print(count)
        


Fixed submission:
# coding: utf-8
# Your code here!
import collections 
 
N=int(input())
l=[]
 
for i in range(N):
    l.append(list(input()))
    l[i].sort()
    l[i]="".join(l[i])
    
clist=list(collections.Counter(l).values())

count=0
for c in clist:
    count+=int(c*(c-1)//2)
    
print(count)