Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

tmp = []
counter = 0
for i in range(N):
    new_str = ''.join(sorted(str(input()))) 
    tmp.append(new_str)
    counter += tmp.count(new_str)

#new_str_list = [i for i in new_str = ''.join(list(sorted(str(input()))))]
#print(new_str_list)

    #for j in range(i):
    #    if str(new_str) == str(tmp[j]):
    #        counter += 1

print(counter-len(tmp))

Fixed submission:
N = int(input())

tmp = []
counter = 0
for i in range(N):
    new_str = ''.join(sorted(str(input())))
    
    #if i != 0:
    #    counter += tmp.count(new_str)
    tmp.append(new_str)

import collections
c = collections.Counter(tmp)

#new_str_list = [i for i in new_str = ''.join(list(sorted(str(input()))))]
#print(new_str_list)

    #for j in range(i):
    #    if str(new_str) == str(tmp[j]):
    #        counter += 1
value = list(c.values())
#print(value)

for j in value:
    for k in range(j):
        counter += k

print(counter)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

tmp = []
counter = 0
for i in range(N):
    new_str = ''.join(sorted(str(input())))
    
    if i != 0:
        counter += tmp.count(new_str)
    tmp.append(new_str)

#new_str_list = [i for i in new_str = ''.join(list(sorted(str(input()))))]
#print(new_str_list)

    #for j in range(i):
    #    if str(new_str) == str(tmp[j]):
    #        counter += 1

print(counter)

Fixed submission:
N = int(input())

tmp = []
counter = 0
for i in range(N):
    new_str = ''.join(sorted(str(input())))
    
    #if i != 0:
    #    counter += tmp.count(new_str)
    tmp.append(new_str)

import collections
c = collections.Counter(tmp)

#new_str_list = [i for i in new_str = ''.join(list(sorted(str(input()))))]
#print(new_str_list)

    #for j in range(i):
    #    if str(new_str) == str(tmp[j]):
    #        counter += 1
value = list(c.values())
#print(value)

for j in value:
    for k in range(j):
        counter += k

print(counter)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

tmp = []
counter = 0
for i in range(N):
    new_str = ''.join(list(sorted(str(input()))))
    if i != 0:
        counter += tmp.count(new_str)
    tmp.append(new_str)

    #for j in range(i):
    #    if str(new_str) == str(tmp[j]):
    #        counter += 1

print(counter)

Fixed submission:
N = int(input())

tmp = []
counter = 0
for i in range(N):
    new_str = ''.join(sorted(str(input())))
    
    #if i != 0:
    #    counter += tmp.count(new_str)
    tmp.append(new_str)

import collections
c = collections.Counter(tmp)

#new_str_list = [i for i in new_str = ''.join(list(sorted(str(input()))))]
#print(new_str_list)

    #for j in range(i):
    #    if str(new_str) == str(tmp[j]):
    #        counter += 1
value = list(c.values())
#print(value)

for j in value:
    for k in range(j):
        counter += k

print(counter)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

tmp = []
counter = 0
for i in range(N):
    new_str = ''.join(list(sorted(str(input()))))
    tmp.append(new_str)
    for j in range(i):
        if str(new_str) == str(tmp[j]):
            counter += 1

print(counter)

Fixed submission:
N = int(input())

tmp = []
counter = 0
for i in range(N):
    new_str = ''.join(sorted(str(input())))
    
    #if i != 0:
    #    counter += tmp.count(new_str)
    tmp.append(new_str)

import collections
c = collections.Counter(tmp)

#new_str_list = [i for i in new_str = ''.join(list(sorted(str(input()))))]
#print(new_str_list)

    #for j in range(i):
    #    if str(new_str) == str(tmp[j]):
    #        counter += 1
value = list(c.values())
#print(value)

for j in value:
    for k in range(j):
        counter += k

print(counter)