Buggy python submission (verdict: Time Limit Exceeded):
# 15:20
n = int(input())
s = [0] * n
ans = 0
for i in range(n):
    t = sorted(input())
    ans += s.count(t)
    s[i] = t
print(ans)

Fixed submission:
# 15:20 -16:08 giveup
# 21:45 -22:33 review
from collections import Counter

# 3
# acornistnt
# peanutbomb
# constraint
n = int(input())
s = [''.join(sorted(input())) for _ in range(n)]
# s is ['acinnorstt', 'abbemnoptu', 'acinnorstt']
counter = Counter(s)
# counter is Counter({'acinnorstt': 2, 'abbemnoptu': 1})
# counter.values() is dict_values([3, 2])
ans = sum(x*(x-1)//2 for x in counter.values())
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# 15:20
n = int(input())
s = []
ans = 0
for i in range(n):
    t = sorted(input())
    ans += s.count(t)
    s.append(t)
print(ans)

Fixed submission:
# 15:20 -16:08 giveup
# 21:45 -22:33 review
from collections import Counter

# 3
# acornistnt
# peanutbomb
# constraint
n = int(input())
s = [''.join(sorted(input())) for _ in range(n)]
# s is ['acinnorstt', 'abbemnoptu', 'acinnorstt']
counter = Counter(s)
# counter is Counter({'acinnorstt': 2, 'abbemnoptu': 1})
# counter.values() is dict_values([3, 2])
ans = sum(x*(x-1)//2 for x in counter.values())
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# 15:20
n = int(input())
s = []
ans = 0
for i in range(n):
    t = sorted(input())
    ans += s.count(t)
    s.append(t)
print(ans)

Fixed submission:
# 15:20 -16:08 giveup
# 21:45 -22:33 review
from collections import Counter

# 3
# acornistnt
# peanutbomb
# constraint
n = int(input())
s = [''.join(sorted(input())) for _ in range(n)]
# s is ['acinnorstt', 'abbemnoptu', 'acinnorstt']
counter = Counter(s)
# counter is Counter({'acinnorstt': 2, 'abbemnoptu': 1})
# counter.values() is dict_values([3, 2])
ans = sum(x*(x-1)//2 for x in counter.values())
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# 15:20
n = int(input())
s = []
ans = 0
for i in range(n):
    t = sorted(input())
    ans += s.count(t)
    s.append(t)
print(ans)

Fixed submission:
# 15:20 -16:08 giveup
# 21:45 -22:33 review
from collections import Counter

# 3
# acornistnt
# peanutbomb
# constraint
n = int(input())
s = [''.join(sorted(input())) for _ in range(n)]
# s is ['acinnorstt', 'abbemnoptu', 'acinnorstt']
counter = Counter(s)
# counter is Counter({'acinnorstt': 2, 'abbemnoptu': 1})
# counter.values() is dict_values([3, 2])
ans = sum(x*(x-1)//2 for x in counter.values())
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# 15:20
n = int(input())
s = []
for i in range(n):
    s.append(sorted(input()))
ans = 0
for i in range(n-1):
    ans += s[i+1:].count(s[i])
print(ans)


Fixed submission:
# 15:20 -16:08 giveup
# 21:45 -22:33 review
from collections import Counter

# 3
# acornistnt
# peanutbomb
# constraint
n = int(input())
s = [''.join(sorted(input())) for _ in range(n)]
# s is ['acinnorstt', 'abbemnoptu', 'acinnorstt']
counter = Counter(s)
# counter is Counter({'acinnorstt': 2, 'abbemnoptu': 1})
# counter.values() is dict_values([3, 2])
ans = sum(x*(x-1)//2 for x in counter.values())
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# 15:20
n = int(input())
s = []
for i in range(n):
    s.append(input())
ans = 0
for i in range(n-1):
    for j in range(i+1,n):
        if sorted(s[i]) == sorted(s[j]):
            ans += 1
print(ans)

Fixed submission:
# 15:20 -16:08 giveup
# 21:45 -22:33 review
from collections import Counter

# 3
# acornistnt
# peanutbomb
# constraint
n = int(input())
s = [''.join(sorted(input())) for _ in range(n)]
# s is ['acinnorstt', 'abbemnoptu', 'acinnorstt']
counter = Counter(s)
# counter is Counter({'acinnorstt': 2, 'abbemnoptu': 1})
# counter.values() is dict_values([3, 2])
ans = sum(x*(x-1)//2 for x in counter.values())
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# 15:20
n = int(input())
s = []
for i in range(n):
    s.append(input())
ans = 0
for i in range(n-1):
    L = []
    for j in range(10):
        L.append((s[i][j], s[i].count(s[i][j])))
    L = sorted(L)
    for k in range(i+1,n):
        R = []
        for l in range(10):
            R.append((s[k][l], s[k].count(s[k][l])))
        R = sorted(R)
        if L == R:
            ans += 1
print(ans)


Fixed submission:
# 15:20 -16:08 giveup
# 21:45 -22:33 review
from collections import Counter

# 3
# acornistnt
# peanutbomb
# constraint
n = int(input())
s = [''.join(sorted(input())) for _ in range(n)]
# s is ['acinnorstt', 'abbemnoptu', 'acinnorstt']
counter = Counter(s)
# counter is Counter({'acinnorstt': 2, 'abbemnoptu': 1})
# counter.values() is dict_values([3, 2])
ans = sum(x*(x-1)//2 for x in counter.values())
print(ans)