Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
#S = [input() for i in range(N)]
S=[]
alpha_dic={"a":[],"b":[],"c":[],"d":[],"e":[],"f":[],"g":[],"h":[],"i":[],"j":[],"k":[],"l":[],"m":[],"n":[],"o":[],"p":[],"q":[],"r":[],"s":[],"t":[],"u":[],"v":[],"w":[],"x":[],"y":[],"z":[]}
ans_list = []
temp_ans = 1
ans = 0

for i in range(N):
    temp = sorted(list(input()))
    #S.append(''.join(temp))
    #alpha_dic[temp[0]].append(i) 
    alpha_dic[temp[0]].append(''.join(temp)) 

for key,value in alpha_dic.items():
    set_S = set(value)
    for s in set_S:
        a = value.count(s)
        ans += a*(a-1)/2

print(round(ans))

Fixed submission:
N = int(input())
#S = [input() for i in range(N)]
S=[]
ans_dic={}
temp_ans = 1
ans = 0

for i in range(N):
    temp = sorted(list(input()))
    temp = ''.join(temp)
    #S.append(''.join(temp))
    #alpha_dic[temp[0]].append(i) 
    if temp in ans_dic:
        ans_dic[temp] += 1
    else:
        ans_dic[temp] = 1
    
for key,value in ans_dic.items():
    ans += value*(value-1)/2

print(round(ans))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
#S = [input() for i in range(N)]
S=[]
firstalpha=[]
ans_list = []
temp_ans = 1
ans = 0

for i in range(N):
    temp = sorted(list(input()))
    S.append(''.join(temp))
    #firstalpha.append(temp[0])
    
set_S = set(S)

for s in set_S:
    a = S.count(s)
    ans += a*(a-1)/2

print(round(ans))

Fixed submission:
N = int(input())
#S = [input() for i in range(N)]
S=[]
ans_dic={}
temp_ans = 1
ans = 0

for i in range(N):
    temp = sorted(list(input()))
    temp = ''.join(temp)
    #S.append(''.join(temp))
    #alpha_dic[temp[0]].append(i) 
    if temp in ans_dic:
        ans_dic[temp] += 1
    else:
        ans_dic[temp] = 1
    
for key,value in ans_dic.items():
    ans += value*(value-1)/2

print(round(ans))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
#S = [input() for i in range(N)]
S=[]
firstalpha=[]
ans_list = []
temp_ans = 1
ans = 0

for i in range(N):
    temp = sorted(list(input()))
    S.append(''.join(temp))
    #firstalpha.append(temp[0])
    
set_S = set(S)

for s in set_S:
    ans_list.append(S.count(s))

for a in ans_list:
    ans += a*(a-1)/2

print(round(ans))

Fixed submission:
N = int(input())
#S = [input() for i in range(N)]
S=[]
ans_dic={}
temp_ans = 1
ans = 0

for i in range(N):
    temp = sorted(list(input()))
    temp = ''.join(temp)
    #S.append(''.join(temp))
    #alpha_dic[temp[0]].append(i) 
    if temp in ans_dic:
        ans_dic[temp] += 1
    else:
        ans_dic[temp] = 1
    
for key,value in ans_dic.items():
    ans += value*(value-1)/2

print(round(ans))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
#S = [input() for i in range(N)]
S=[]
ans_list = []
temp_ans = 1
ans = 0
iscalc = [True]*N

for i in range(N):
    S.append(''.join(sorted(list(input()))))

for i in range(N):
    if iscalc[i]:
        for j in range(i+1,N):
            if S[i]==S[j]:
                temp_ans += 1
                iscalc[j]=False
        ans_list.append(temp_ans)
        temp_ans=1


for a in ans_list:
    ans += a*(a-1)/2

print(round(ans))

Fixed submission:
N = int(input())
#S = [input() for i in range(N)]
S=[]
ans_dic={}
temp_ans = 1
ans = 0

for i in range(N):
    temp = sorted(list(input()))
    temp = ''.join(temp)
    #S.append(''.join(temp))
    #alpha_dic[temp[0]].append(i) 
    if temp in ans_dic:
        ans_dic[temp] += 1
    else:
        ans_dic[temp] = 1
    
for key,value in ans_dic.items():
    ans += value*(value-1)/2

print(round(ans))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
#S = [input() for i in range(N)]
S=[]
ans_list = []
temp_ans = 0
ans = 0

for i in range(N):
    S.append(''.join(sorted(list(input()))))

string_set = set(S)

for s in string_set:
    for i in S:
        if s==i:
            temp_ans += 1
    ans_list.append(temp_ans)
    temp_ans = 0

for a in ans_list:
    ans += a*(a-1)/2

print(round(ans))

Fixed submission:
N = int(input())
#S = [input() for i in range(N)]
S=[]
ans_dic={}
temp_ans = 1
ans = 0

for i in range(N):
    temp = sorted(list(input()))
    temp = ''.join(temp)
    #S.append(''.join(temp))
    #alpha_dic[temp[0]].append(i) 
    if temp in ans_dic:
        ans_dic[temp] += 1
    else:
        ans_dic[temp] = 1
    
for key,value in ans_dic.items():
    ans += value*(value-1)/2

print(round(ans))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
#S = [input() for i in range(N)]
S=[]
ans = 0

for i in range(N):
    S.append(''.join(sorted(list(input()))))

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

Fixed submission:
N = int(input())
#S = [input() for i in range(N)]
S=[]
ans_dic={}
temp_ans = 1
ans = 0

for i in range(N):
    temp = sorted(list(input()))
    temp = ''.join(temp)
    #S.append(''.join(temp))
    #alpha_dic[temp[0]].append(i) 
    if temp in ans_dic:
        ans_dic[temp] += 1
    else:
        ans_dic[temp] = 1
    
for key,value in ans_dic.items():
    ans += value*(value-1)/2

print(round(ans))