Buggy python submission (verdict: Time Limit Exceeded):
#import numpy as np
n=int(input())
strl=[list(input()) for i in range(n)]

count=0
#il=np.arange(n)
for i in range(n) :
  sal=strl[i]
  jl=list(range(i+1,n))
  for j in jl :
    flag=True
    sbl=strl[j]
    sal.sort()
    sbl.sort()
    if sal==sbl:
      count+=1
print(count)

Fixed submission:
#import numpy as np
n=int(input())
strl=[list(input()) for i in range(n)]

count=0
pt={}
#il=np.arange(n)
for i in range(n) :
  sal=strl[i]
  sal.sort()
  temp="".join(sal)
  if temp in pt.keys() :
    #ptがある
    tempc=pt[temp]
    count+=tempc
    pt[temp]=tempc+1
  else :
    pt[temp]=1
print(count)
#print(count)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
strl=[list(input()) for i in range(n)]
"""
def anagram(sa,sb) :
  flag=True
  sal=list(sa)
  sbl=list(sb)
  sal.sort()
  sbl.sort()
  if sal==sbl:
    return True
  else :
    return False
  
  for i in range(10) :
    if sal[i] in sbl :
      sbl.remove(sal[i])
    else :
      flag=False
      break

  """
  #return flag
   
#print(anagram("peanutbomb","constraint"))    
count=0
for i in range(n) :
  jl=list(range(i+1,n))
  for j in jl :
    flag=True
    sal=strl[i]
    sbl=strl[j]
    sal.sort()
    sbl.sort()
    if sal==sbl:
      count+=1
    """
    flag=True
    sal=list(strl[i])
    sbl=list(strl[j])
    for k in range(10):
      tmp=sal[k]
      if tmp in sbl :
        sbl.remove(tmp)
      else :
        flag=False
        break
     
    if flag :
      count+=1
    """
print(count)

Fixed submission:
#import numpy as np
n=int(input())
strl=[list(input()) for i in range(n)]

count=0
pt={}
#il=np.arange(n)
for i in range(n) :
  sal=strl[i]
  sal.sort()
  temp="".join(sal)
  if temp in pt.keys() :
    #ptがある
    tempc=pt[temp]
    count+=tempc
    pt[temp]=tempc+1
  else :
    pt[temp]=1
print(count)
#print(count)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
strl=[input() for i in range(n)]
"""
def anagram(sa,sb) :
  flag=True
  sal=list(sa)
  sbl=list(sb)
  sal.sort()
  sbl.sort()
  if sal==sbl:
    return True
  else :
    return False
  
  for i in range(10) :
    if sal[i] in sbl :
      sbl.remove(sal[i])
    else :
      flag=False
      break

  """
  #return flag
   
#print(anagram("peanutbomb","constraint"))    
count=0
for i in range(n) :
  jl=list(range(i+1,n))
  for j in jl :
    flag=True
    sal=list(strl[i])
    sbl=list(strl[j])
    sal.sort()
    sbl.sort()
    if sal==sbl:
      count+=1
print(count)

Fixed submission:
#import numpy as np
n=int(input())
strl=[list(input()) for i in range(n)]

count=0
pt={}
#il=np.arange(n)
for i in range(n) :
  sal=strl[i]
  sal.sort()
  temp="".join(sal)
  if temp in pt.keys() :
    #ptがある
    tempc=pt[temp]
    count+=tempc
    pt[temp]=tempc+1
  else :
    pt[temp]=1
print(count)
#print(count)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
strl=[input() for i in range(n)]

def anagram(sa,sb) :
  flag=True
  sal=list(sa)
  sbl=list(sb)
  sal.sort()
  sbl.sort()
  if sal==sbl:
    return True
  else :
    return False
  """
  for i in range(10) :
    if sal[i] in sbl :
      sbl.remove(sal[i])
    else :
      flag=False
      break
  """
  #return flag
   
#print(anagram("peanutbomb","constraint"))    
count=0
for i in range(n) :
  for j in range(n) :
    if i>= j :
      continue
    if anagram(strl[i],strl[j]) ==True :
      count+=1
print(count)

Fixed submission:
#import numpy as np
n=int(input())
strl=[list(input()) for i in range(n)]

count=0
pt={}
#il=np.arange(n)
for i in range(n) :
  sal=strl[i]
  sal.sort()
  temp="".join(sal)
  if temp in pt.keys() :
    #ptがある
    tempc=pt[temp]
    count+=tempc
    pt[temp]=tempc+1
  else :
    pt[temp]=1
print(count)
#print(count)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
strl=[input() for i in range(n)]

def anagram(sa,sb) :
  flag=True
  sal=list(sa)
  sbl=list(sb)
  sal.sort()
  sbl.sort()
  if sal==sbl:
    return True
  else :
    return False
  """
  for i in range(10) :
    if sal[i] in sbl :
      sbl.remove(sal[i])
    else :
      flag=False
      break
  """
  #return flag
   
#print(anagram("peanutbomb","constraint"))    
count=0
for i in range(n) :
  for j in range(n) :
    if i>= j :
      continue
    if anagram(strl[i],strl[j]) ==True :
      count+=1
print(count)

Fixed submission:
#import numpy as np
n=int(input())
strl=[list(input()) for i in range(n)]

count=0
pt={}
#il=np.arange(n)
for i in range(n) :
  sal=strl[i]
  sal.sort()
  temp="".join(sal)
  if temp in pt.keys() :
    #ptがある
    tempc=pt[temp]
    count+=tempc
    pt[temp]=tempc+1
  else :
    pt[temp]=1
print(count)
#print(count)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
strl=[input() for i in range(n)]

def anagram(sa,sb) :
  flag=True
  sal=list(sa)
  sbl=list(sb)
  for st in sal :
    if st in sbl :
      sbl.remove(st)
    else :
      flag=False
      break
  if flag==False :
    return False
  else:
    return True
   
#print(anagram("peanutbomb","constraint"))    
count=0
for i in range(n) :
  for j in range(n) :
    if i>= j :
      continue
    if anagram(strl[i],strl[j]) ==True :
      count+=1
print(count)

Fixed submission:
#import numpy as np
n=int(input())
strl=[list(input()) for i in range(n)]

count=0
pt={}
#il=np.arange(n)
for i in range(n) :
  sal=strl[i]
  sal.sort()
  temp="".join(sal)
  if temp in pt.keys() :
    #ptがある
    tempc=pt[temp]
    count+=tempc
    pt[temp]=tempc+1
  else :
    pt[temp]=1
print(count)
#print(count)