Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
import sys
def input() -> str:
    return sys.stdin.readline()
n = int(input())
s = [input() for _ in range(n)]
clist, cnt = [], []
for si in s:
    c = Counter(si)
    # print(c)
    if c in clist:
        cnt[clist.index(c)] += 1
    else:
        clist.append(c)
        cnt.append(1)
ans = 0
for ci in cnt:
    ans += sum(range(1, ci))
print(ans)


Fixed submission:
import sys
input = sys.stdin.readline
n = int(input())
s = ["".join(sorted(input().split()[0])) for _ in range(n)]
cnt = {}
result = 0
for si in s:
    if si in cnt:
        result += cnt[si]
        cnt[si] += 1
    else:
        cnt[si] = 1
print(result)

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

n = int(input())
s = [input() for _ in range(n)]
clist, cnt = [], []
for si in s:
    c = Counter(si)
    # print(c)
    if c in clist:
        cnt[clist.index(c)] += 1
    else:
        clist.append(c)
        cnt.append(1)
ans = 0
for ci in cnt:
    ans += sum(range(1, ci))
print(ans)

Fixed submission:
import sys
input = sys.stdin.readline
n = int(input())
s = ["".join(sorted(input().split()[0])) for _ in range(n)]
cnt = {}
result = 0
for si in s:
    if si in cnt:
        result += cnt[si]
        cnt[si] += 1
    else:
        cnt[si] = 1
print(result)

Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
n = int(input())
s = ["".join(sorted(input().split()[0])) for _ in range(n)]
cnt = {}
result = 0
for si in s:
    if si in cnt:
        result += cnt[si]
        cnt[si] += 1
    else:
        cnt[si] = 1
print(result

Fixed submission:
import sys
input = sys.stdin.readline
n = int(input())
s = ["".join(sorted(input().split()[0])) for _ in range(n)]
cnt = {}
result = 0
for si in s:
    if si in cnt:
        result += cnt[si]
        cnt[si] += 1
    else:
        cnt[si] = 1
print(result)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
from itertools import combinations
import sys
input = sys.stdin.readline
n = int(input())
cnt = Counter(["".join(sorted(input().split()[0])) for _ in range(n)])
print(sum([len(list(combinations([""] * cnt[c], 2))) for c in cnt]))

Fixed submission:
import sys
input = sys.stdin.readline
n = int(input())
s = ["".join(sorted(input().split()[0])) for _ in range(n)]
cnt = {}
result = 0
for si in s:
    if si in cnt:
        result += cnt[si]
        cnt[si] += 1
    else:
        cnt[si] = 1
print(result)

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

n = int(input())
s = ["".join(sorted(input().split()[0])) for _ in range(n)]
result = 0
cnt = Counter(s)
for c in cnt:
    result += len(list(combinations([""] * cnt[c], 2)))
print(result)

Fixed submission:
import sys
input = sys.stdin.readline
n = int(input())
s = ["".join(sorted(input().split()[0])) for _ in range(n)]
cnt = {}
result = 0
for si in s:
    if si in cnt:
        result += cnt[si]
        cnt[si] += 1
    else:
        cnt[si] = 1
print(result)

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

n = int(input())
s = [list(input().split()[0]) for _ in range(n)]
cnt = defaultdict(int)
for i in range(n):
  s[i].sort()
  cnt["".join(s[i])] += 1
result = 0
for c in cnt:
  result += len(list(combinations([""] * cnt[c], 2)))
print(result)

Fixed submission:
import sys
input = sys.stdin.readline
n = int(input())
s = ["".join(sorted(input().split()[0])) for _ in range(n)]
cnt = {}
result = 0
for si in s:
    if si in cnt:
        result += cnt[si]
        cnt[si] += 1
    else:
        cnt[si] = 1
print(result)

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

n = int(input())
s = [input().split()[0] for _ in range(n)]
cnt = defaultdict(int)
for i in range(n):
    cnt["".join(sorted(s[i]))] += 1
result = 0
for c in cnt:
    result += len(list(combinations([""] * cnt[c], 2)))
print(result)

Fixed submission:
import sys
input = sys.stdin.readline
n = int(input())
s = ["".join(sorted(input().split()[0])) for _ in range(n)]
cnt = {}
result = 0
for si in s:
    if si in cnt:
        result += cnt[si]
        cnt[si] += 1
    else:
        cnt[si] = 1
print(result)

Buggy python submission (verdict: Runtime Error):
from collections import defaultdict
from itertools import combinations
import sys
input = sys.stdin.readline

n = int(input())
s = [input().split()[0] for _ in range(n)]
cnt = defaultdict(int)
for i in range(n):
    s[i].sort()
    cnt["".join(s[i])] += 1
result = 0
for c in cnt:
    result += len(list(combinations([""] * cnt[c], 2)))
print(result)

Fixed submission:
import sys
input = sys.stdin.readline
n = int(input())
s = ["".join(sorted(input().split()[0])) for _ in range(n)]
cnt = {}
result = 0
for si in s:
    if si in cnt:
        result += cnt[si]
        cnt[si] += 1
    else:
        cnt[si] = 1
print(result)

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

n = int(input())
s = [input().split()[0] for _ in range(n)]
cnt = defaultdict(int)
for i in range(n):
    cnt["".join(sorted(s[i]))] += 1
result = 0
for c in cnt:
    result += len(list(combinations([""] * cnt[c], 2)))
print(result)

Fixed submission:
import sys
input = sys.stdin.readline
n = int(input())
s = ["".join(sorted(input().split()[0])) for _ in range(n)]
cnt = {}
result = 0
for si in s:
    if si in cnt:
        result += cnt[si]
        cnt[si] += 1
    else:
        cnt[si] = 1
print(result)

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

n = int(input())
s = [input().split()[0] for _ in range(n)]
cnt = defaultdict(int)
for i in range(n):
    cnt["".join(sorted(s[i]))] += 1
result = 0
for c in cnt:
    for i in combinations([""] * cnt[c], 2):
        result += 1
print(result)

Fixed submission:
import sys
input = sys.stdin.readline
n = int(input())
s = ["".join(sorted(input().split()[0])) for _ in range(n)]
cnt = {}
result = 0
for si in s:
    if si in cnt:
        result += cnt[si]
        cnt[si] += 1
    else:
        cnt[si] = 1
print(result)