Buggy python submission (verdict: Runtime Error):
n=int(input().split())
dic={}
for i in range(0,n):
  s="".join(sorted(input()))
  if s in dic:
    dic[s]+=1
  else:
    dic[s]=1
    
ans=0    
for a in dic.values():
  ans+=(a*(a-1))/2
  
print(ans)

Fixed submission:
n=int(input())
dic={}
for _ in range(0,n):
  s="".join(sorted(input()))
  if s in dic:
    dic[s]+=1
  else:
    dic[s]=1
    
ans=0    
for a in dic.values():
  ans+=(a*(a-1))/2
  
print(int(ans))

Buggy python submission (verdict: Runtime Error):
n=int(input())
ans=0
for i in range(0,n):
  s=input().split()
  s[i]=''.join(sorted(s))
  
for j in range(0,n-1):
  for k in range(j+1,n):
    if li[j]==li[k]:
      ans+=1
    else:
      ans+=0
      
print(ans)      


Fixed submission:
n=int(input())
dic={}
for _ in range(0,n):
  s="".join(sorted(input()))
  if s in dic:
    dic[s]+=1
  else:
    dic[s]=1
    
ans=0    
for a in dic.values():
  ans+=(a*(a-1))/2
  
print(int(ans))

Buggy python submission (verdict: Runtime Error):
n=int(input())
s=list(map(str,input().split()))
li=[0]*n
ans=0
for i in range(0,n):
  li[i]=''.join(sorted(s[i]))
  
for j in range(0,n-1):
  for k in range(j+1,n):
    if li[j]==li[k]:
      ans+=1
    else:
      ans+=0
      
print(ans)      


Fixed submission:
n=int(input())
dic={}
for _ in range(0,n):
  s="".join(sorted(input()))
  if s in dic:
    dic[s]+=1
  else:
    dic[s]=1
    
ans=0    
for a in dic.values():
  ans+=(a*(a-1))/2
  
print(int(ans))

Buggy python submission (verdict: Runtime Error):
n=int(input())
s=list(map(str,input().split()))
li=[0]*n
ans=0
for i in range(0,n):
  li[i]=sorted(s[i])
  
for j in range(0,n-1):
  for k in range(j+1,n):
    if li[j]==li[k]:
      ans+=1
    else:
      ans+=0
      
print(ans)      


Fixed submission:
n=int(input())
dic={}
for _ in range(0,n):
  s="".join(sorted(input()))
  if s in dic:
    dic[s]+=1
  else:
    dic[s]=1
    
ans=0    
for a in dic.values():
  ans+=(a*(a-1))/2
  
print(int(ans))

Buggy python submission (verdict: Runtime Error):
n=int(input())
s=list(map(input().split()))
li=[0]*n
ans=0
for i in range(0,n):
  li[i]=sorted(s[i])
  
for j in range(0,n-1):
  for k in range(j+1,n):
    if li[j]==li[k]:
      ans+=1
    else:
      ans+=0
      
print(ans)      


Fixed submission:
n=int(input())
dic={}
for _ in range(0,n):
  s="".join(sorted(input()))
  if s in dic:
    dic[s]+=1
  else:
    dic[s]=1
    
ans=0    
for a in dic.values():
  ans+=(a*(a-1))/2
  
print(int(ans))

Buggy python submission (verdict: Runtime Error):
n=int(input())

li=[0]*n
ans=0
for i in range(0,n):
  s=list(input().split())
  li[i]=sorted(s[i])
for j in range(0,n-1):
  for k in range(j+1,n):
    if li[j]==li[k]:
      ans+=1
      
print(ans)      


Fixed submission:
n=int(input())
dic={}
for _ in range(0,n):
  s="".join(sorted(input()))
  if s in dic:
    dic[s]+=1
  else:
    dic[s]=1
    
ans=0    
for a in dic.values():
  ans+=(a*(a-1))/2
  
print(int(ans))

Buggy python submission (verdict: Runtime Error):
n=int(input())
s=list(map(input().split()))
li=[0]*n
ans=0
for i in range(0,n):
  li[i]=sorted(s[i])
for j in range(0,n):
  for k in range(j+1,n):
    if li[j]==li[k]:
      ans+=1
      
print(ans)      

Fixed submission:
n=int(input())
dic={}
for _ in range(0,n):
  s="".join(sorted(input()))
  if s in dic:
    dic[s]+=1
  else:
    dic[s]=1
    
ans=0    
for a in dic.values():
  ans+=(a*(a-1))/2
  
print(int(ans))