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

n = int(input())
note = dict()
ans = 0
for i in range(n):
    s = "".join(sorted(sys.stdin.readline()))
    if s in note.keys():
        ans += note[s]
        note[s] += 1
    else:
        note[s] = 1

print(ans)

Fixed submission:
import sys
#input = sys.stdin.readline

n = int(input())
note = dict()
ans = 0
for i in range(n):
    s = "".join(sorted(sys.stdin.readline()))
    if s in note.keys():
        ans += note[s]
        note[s] += 1
    else:
        note[s] = 1

print(ans)

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

n = int(input())
note = dict()
ans = 0
for i in range(n):
    s = "".join(sorted(input()))
    if s in note.keys():
        ans += note[s]
        note[s] += 1
    else:
        note[s] = 1

print(ans)

Fixed submission:
import sys
#input = sys.stdin.readline

n = int(input())
note = dict()
ans = 0
for i in range(n):
    s = "".join(sorted(sys.stdin.readline()))
    if s in note.keys():
        ans += note[s]
        note[s] += 1
    else:
        note[s] = 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
note = dict()
ans = 0
for i in range(n):
    s = "".join(sorted(input()))
    if s in note.keys():
        ans += note[s]
        note[s] += 1
    else:
        note[s] = 1

print(ans)

Fixed submission:
import sys
#input = sys.stdin.readline

n = int(input())
note = dict()
ans = 0
for i in range(n):
    s = "".join(sorted(sys.stdin.readline()))
    if s in note.keys():
        ans += note[s]
        note[s] += 1
    else:
        note[s] = 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
note = dict()
for i in range(n):
    s = "".join(sorted(input()))
    if s in note.keys():
        note[s] += 1
    else:
        note[s] = 1

ans = 0
for i in note.values():
    ans += i*(i-1)//2

print(ans)

Fixed submission:
import sys
#input = sys.stdin.readline

n = int(input())
note = dict()
ans = 0
for i in range(n):
    s = "".join(sorted(sys.stdin.readline()))
    if s in note.keys():
        ans += note[s]
        note[s] += 1
    else:
        note[s] = 1

print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
note = dict()
for i in range(n):
    s = "".join(sorted(input()))
    if s in note.keys():
        note[s] += 1
    else:
        note[s] = 1
        
import collections
c = collections.deque(note.values())
ans = 0
for i in range(c):
    q = c.popleft()
    ans += q*(q-1)//2

print(ans)

Fixed submission:
import sys
#input = sys.stdin.readline

n = int(input())
note = dict()
ans = 0
for i in range(n):
    s = "".join(sorted(sys.stdin.readline()))
    if s in note.keys():
        ans += note[s]
        note[s] += 1
    else:
        note[s] = 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
note = dict()
for i in range(n):
    s = "".join(sorted(input()))
    if s in note.keys():
        note[s] += 1
    else:
        note[s] = 1
        
ans = 0
for i in note.values():
    ans += i*(i-1)//2

print(ans)

Fixed submission:
import sys
#input = sys.stdin.readline

n = int(input())
note = dict()
ans = 0
for i in range(n):
    s = "".join(sorted(sys.stdin.readline()))
    if s in note.keys():
        ans += note[s]
        note[s] += 1
    else:
        note[s] = 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
info=[]
for i in range(n):
  info.append(list(input()))
  
for i in range(n):
  info[i].sort()
  
ans=0
for i in range(n):
  for j in range(n-i-1):
    if info[i]==info[i+j+1]:
      ans+=1
      
print(ans)

Fixed submission:
import sys
#input = sys.stdin.readline

n = int(input())
note = dict()
ans = 0
for i in range(n):
    s = "".join(sorted(sys.stdin.readline()))
    if s in note.keys():
        ans += note[s]
        note[s] += 1
    else:
        note[s] = 1

print(ans)