Buggy python submission (verdict: Runtime Error):
from collections import Counter

N=int(input())
dic＝{}

ans=0

for i in range(N):
    si=input()
    # ci=Counter(si)
    # c=sorted(ci.elements())
    # c=sorted(Counter(si).elements())
    sorted_s=''.join(sorted(Counter(si).elements()))
    if sorted_s in dic:
        ans+=dic[sorted_s]
        dic[sorted_s]+=1
    else:
        dic[sorted_s]=1

print(ans)

Fixed submission:
from collections import Counter

N=int(input())
dic={}

ans=0

for i in range(N):
    si=input()
    # ci=Counter(si)
    # c=sorted(ci.elements())
    # c=sorted(Counter(si).elements())
    sorted_s=''.join(sorted(Counter(si).elements()))
    if sorted_s in dic:
        ans+=dic[sorted_s]
        dic[sorted_s]+=1
    else:
        dic[sorted_s]=1
print(ans)

Buggy python submission (verdict: Runtime Error):
from collections import Counter

N=int(input())
dic＝{}

ans=0

for i in range(N):
    si=input()
    # ci=Counter(si)
    # c=sorted(ci.elements())
    # c=sorted(Counter(si).elements())
    sorted_s=''.join(sorted(Counter(si).elements()))
    if sorted_s in dic:
        ans+=dic[sorted_s]
        dic[sorted_s]]+=1
    else:
        dic[sorted_s]=1

print(ans)

Fixed submission:
from collections import Counter

N=int(input())
dic={}

ans=0

for i in range(N):
    si=input()
    # ci=Counter(si)
    # c=sorted(ci.elements())
    # c=sorted(Counter(si).elements())
    sorted_s=''.join(sorted(Counter(si).elements()))
    if sorted_s in dic:
        ans+=dic[sorted_s]
        dic[sorted_s]+=1
    else:
        dic[sorted_s]=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

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

ans=0

for i in range(N):
    si=input()
    # ci=Counter(si)
    # c=sorted(ci.elements())
    # c=sorted(Counter(si).elements())
    sorted_s=''.join(sorted(Counter(si).elements()))
    if sorted_s in l:
        ans+=v[l.index(sorted_s)]
        v[l.index(sorted_s)]+=1
    else:
        l.append(sorted_s)
        v.append(1)

print(ans)

Fixed submission:
from collections import Counter

N=int(input())
dic={}

ans=0

for i in range(N):
    si=input()
    # ci=Counter(si)
    # c=sorted(ci.elements())
    # c=sorted(Counter(si).elements())
    sorted_s=''.join(sorted(Counter(si).elements()))
    if sorted_s in dic:
        ans+=dic[sorted_s]
        dic[sorted_s]+=1
    else:
        dic[sorted_s]=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

N=int(input())
L=[]
V=[]
LV=[]

for i in range(N):
    si=input()
    # ci=Counter(si)
    # c=sorted(ci.elements())
    # c=sorted(Counter(si).elements())
    sorted_s=''.join(sorted(Counter(si).elements()))
    if sorted_s in L:
        ind=L.index(sorted_s)
        V[ind]+=1
    else:
        L.append(sorted_s)
        V.append(1)

ans=0

for v in V:
    ans+=v*(v-1)//2

print(ans)

Fixed submission:
from collections import Counter

N=int(input())
dic={}

ans=0

for i in range(N):
    si=input()
    # ci=Counter(si)
    # c=sorted(ci.elements())
    # c=sorted(Counter(si).elements())
    sorted_s=''.join(sorted(Counter(si).elements()))
    if sorted_s in dic:
        ans+=dic[sorted_s]
        dic[sorted_s]+=1
    else:
        dic[sorted_s]=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

N=int(input())
L=[]
V=[]
LV=[]

for i in range(N):
    si=input()
    # ci=Counter(si)
    # c=sorted(ci.elements())
    c=sorted(Counter(si).elements())
    if c in L:
        ind=L.index(c)
        V[ind]+=1
    else:
        L.append(c)
        V.append(1)

ans=0

for v in V:
    ans+=v*(v-1)//2

print(ans)

Fixed submission:
from collections import Counter

N=int(input())
dic={}

ans=0

for i in range(N):
    si=input()
    # ci=Counter(si)
    # c=sorted(ci.elements())
    # c=sorted(Counter(si).elements())
    sorted_s=''.join(sorted(Counter(si).elements()))
    if sorted_s in dic:
        ans+=dic[sorted_s]
        dic[sorted_s]+=1
    else:
        dic[sorted_s]=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

N=int(input())
L=[]
V=[]

for i in range(N):
    si=input()
    # ci=Counter(si)
    # c=sorted(ci.elements())
    c=sorted(Counter(si).elements())
    v=L.count(c)
    if v==0:
        L.append(c)
        V.append(1)
    else:
        ind=L.index(c)
        V[ind]+=1


ans=0

for v in V:
    ans+=v*(v-1)//2

print(ans)

Fixed submission:
from collections import Counter

N=int(input())
dic={}

ans=0

for i in range(N):
    si=input()
    # ci=Counter(si)
    # c=sorted(ci.elements())
    # c=sorted(Counter(si).elements())
    sorted_s=''.join(sorted(Counter(si).elements()))
    if sorted_s in dic:
        ans+=dic[sorted_s]
        dic[sorted_s]+=1
    else:
        dic[sorted_s]=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

N=int(input())
L=[]
V=[]

for i in range(N):
    si=input()
    ci=Counter(si)
    c=sorted(ci.elements())
    v=L.count(c)
    if v==0:
        L.append(c)
        V.append(1)
    else:
        ind=L.index(c)
        V[ind]+=1


ans=0

for v in V:
    ans+=v*(v-1)//2

print(ans)

Fixed submission:
from collections import Counter

N=int(input())
dic={}

ans=0

for i in range(N):
    si=input()
    # ci=Counter(si)
    # c=sorted(ci.elements())
    # c=sorted(Counter(si).elements())
    sorted_s=''.join(sorted(Counter(si).elements()))
    if sorted_s in dic:
        ans+=dic[sorted_s]
        dic[sorted_s]+=1
    else:
        dic[sorted_s]=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

N=int(input())
L=[]

for i in range(N):
    si=input()
    ci=Counter(si)
    c=sorted(ci.elements())
    L.append(c)


ans=0

for i in range(N):
    for j in range(1,N-i):
        # print('i:{0} j:{1} L{2}:{3} L{4}:{5} TF:{6}'.format(i,j,i,L[i],i+j,L[i+j],L[i]==L[i+j]))
        if L[i]==L[i+j]:
            ans+=1
        else:
            pass
# print(L)
print(ans)

Fixed submission:
from collections import Counter

N=int(input())
dic={}

ans=0

for i in range(N):
    si=input()
    # ci=Counter(si)
    # c=sorted(ci.elements())
    # c=sorted(Counter(si).elements())
    sorted_s=''.join(sorted(Counter(si).elements()))
    if sorted_s in dic:
        ans+=dic[sorted_s]
        dic[sorted_s]+=1
    else:
        dic[sorted_s]=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

N=int(input())
L=[]
for i in range(N):
    si=input()
    ci=Counter(si)
    L.append(ci)


ans=0

for i in range(N):
    for j in range(1,N-i):
        # print('i:{0} j:{1} L{2}:{3} L{4}:{5} TF:{6}'.format(i,j,i,L[i],i+j,L[i+j],L[i]==L[i+j]))
        if L[i]==L[i+j]:
            ans+=1
        else:
            pass

print(ans)

Fixed submission:
from collections import Counter

N=int(input())
dic={}

ans=0

for i in range(N):
    si=input()
    # ci=Counter(si)
    # c=sorted(ci.elements())
    # c=sorted(Counter(si).elements())
    sorted_s=''.join(sorted(Counter(si).elements()))
    if sorted_s in dic:
        ans+=dic[sorted_s]
        dic[sorted_s]+=1
    else:
        dic[sorted_s]=1
print(ans)