Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

N = int(input())
l = [''.join(sorted(list(input())))]
cnt = 0
for i in range(N-1):
    s = ''.join(sorted(list(input())))
    cnt += l.count(s)
    l.append(s)
print(cnt)

Fixed submission:
import collections
from itertools import combinations
import sys
input = sys.stdin.readline

N = int(input())
s = [''.join(sorted(list(input()))) for _ in range(N)]
c = collections.Counter(s)

cnt = 0
for i in c.values():
    if i > 1:
        cnt += i*(i-1)//2
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
N = int(input())
l = [''.join(sorted(list(input())))]
cnt = 0
for i in range(N-1):
    s = ''.join(sorted(list(input())))
    cnt += l.count(s)
    l.append(s)
print(cnt)

Fixed submission:
import collections
from itertools import combinations
import sys
input = sys.stdin.readline

N = int(input())
s = [''.join(sorted(list(input()))) for _ in range(N)]
c = collections.Counter(s)

cnt = 0
for i in c.values():
    if i > 1:
        cnt += i*(i-1)//2
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
import collections
from itertools import combinations
import sys
input = sys.stdin.readline

N = int(input())
s = [''.join(sorted(list(input()))) for _ in range(N)]
#for i in range(N):
#    s.append(''.join(sorted(list(input()))))
c = collections.Counter(s)

cnt = 0
for i in c.values():
    if i > 1:
        cnt += len(tuple(combinations(range(i), 2)))
print(cnt)

Fixed submission:
import collections
from itertools import combinations
import sys
input = sys.stdin.readline

N = int(input())
s = [''.join(sorted(list(input()))) for _ in range(N)]
c = collections.Counter(s)

cnt = 0
for i in c.values():
    if i > 1:
        cnt += i*(i-1)//2
print(cnt)

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

N = int(input())
s = [''.join(sorted(list(input()))) for _ in range(N)]
#for i in range(N):
#    s.append(''.join(sorted(list(input()))))
c = collections.Counter(s)

cnt = 0
for i in c.values():
    if i > 1:
        cnt += len(tuple(combinations(range(i), 2)))
print(cnt)

Fixed submission:
import collections
from itertools import combinations
import sys
input = sys.stdin.readline

N = int(input())
s = [''.join(sorted(list(input()))) for _ in range(N)]
c = collections.Counter(s)

cnt = 0
for i in c.values():
    if i > 1:
        cnt += i*(i-1)//2
print(cnt)

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

N = int(input())
s = []
for i in range(N):
    s.append(''.join(sorted(list(input()))))
c = collections.Counter(s)

cnt = 0
for i in c.values():
    if i > 1:
        cnt += len(list(combinations(range(i), 2)))
print(cnt)

Fixed submission:
import collections
from itertools import combinations
import sys
input = sys.stdin.readline

N = int(input())
s = [''.join(sorted(list(input()))) for _ in range(N)]
c = collections.Counter(s)

cnt = 0
for i in c.values():
    if i > 1:
        cnt += i*(i-1)//2
print(cnt)

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

N = int(input())
s = []
for i in range(N):
    s.append(''.join(sorted(list(input()))))
c = collections.Counter(s)

cnt = 0
for i in c.values():
    if i > 1:
        cnt += len(list(combinations(range(i), 2)))
print(cnt)

Fixed submission:
import collections
from itertools import combinations
import sys
input = sys.stdin.readline

N = int(input())
s = [''.join(sorted(list(input()))) for _ in range(N)]
c = collections.Counter(s)

cnt = 0
for i in c.values():
    if i > 1:
        cnt += i*(i-1)//2
print(cnt)