Buggy python submission (verdict: Runtime Error):
N = int(input())
liss = {}
for i in range(N):
  s = input()
  a = sorted(s)
  if a in liss:
    liss[a] += 1
  else:
    liss[a] = 1

ans = 0
for cc in liss:
  ans = ans + (liss[cc] * (liss[cc] - 1) / 2)
print(int(ans))


Fixed submission:
N = int(input())
liss = {}
for i in range(N):
  s = input()
  a = "".join(sorted(s))
  if a in liss:
    liss[a] += 1
  else:
    liss[a] = 1

ans = 0
for cc in liss:
  ans = ans + (liss[cc] * (liss[cc] - 1) / 2)
print(int(ans))

Buggy python submission (verdict: Runtime Error):
N = int(input())
liss = {}
for i in range(N):
  s = input()
  a = sorted(s)
  if a in liss:
    liss[a] += 1
  else:
    liss[a] = 1

ans = 0
for cc in liss:
  ans = ans + (liss[cc] * (liss[cc] - 1) / 2)
print(int(ans))


Fixed submission:
N = int(input())
liss = {}
for i in range(N):
  s = input()
  a = "".join(sorted(s))
  if a in liss:
    liss[a] += 1
  else:
    liss[a] = 1

ans = 0
for cc in liss:
  ans = ans + (liss[cc] * (liss[cc] - 1) / 2)
print(int(ans))

Buggy python submission (verdict: Runtime Error):
import collections
N = int(input())
liss = {}
for i in range(N):
  s = input()
  a = s.sorted()
  if a in liss:
    liss[a] += 1
  else:
    liss[a] = 1

ans = 0
for cc in liss:
  ans = ans + (liss[cc] * (liss[cc] - 1) / 2)
print(int(ans))


Fixed submission:
N = int(input())
liss = {}
for i in range(N):
  s = input()
  a = "".join(sorted(s))
  if a in liss:
    liss[a] += 1
  else:
    liss[a] = 1

ans = 0
for cc in liss:
  ans = ans + (liss[cc] * (liss[cc] - 1) / 2)
print(int(ans))

Buggy python submission (verdict: Runtime Error):
import collections
N = int(input())
liss = []
for i in range(N):
  s = input()
  a = s.sorted()
  if a in liss:
    liss[a] += 1
  else:
    liss[a] = 1

ans = 0
for cc in liss:
  ans = ans + (liss[cc] * (liss[cc] - 1) / 2)
print(int(ans))


Fixed submission:
N = int(input())
liss = {}
for i in range(N):
  s = input()
  a = "".join(sorted(s))
  if a in liss:
    liss[a] += 1
  else:
    liss[a] = 1

ans = 0
for cc in liss:
  ans = ans + (liss[cc] * (liss[cc] - 1) / 2)
print(int(ans))

Buggy python submission (verdict: Time Limit Exceeded):
import collections
N = int(input())
countr = []
liss = []
ccr = []
for i in range(N):
  s = input()
  a = collections.Counter(s)
  if a in liss:
    ind = liss.index(a)
    ccr[ind] += countr[ind]
    countr[ind] += 1
  else:
    liss.append(a)
    countr.append(1)
    ccr.append(0)


print(int(sum(ccr)))


Fixed submission:
N = int(input())
liss = {}
for i in range(N):
  s = input()
  a = "".join(sorted(s))
  if a in liss:
    liss[a] += 1
  else:
    liss[a] = 1

ans = 0
for cc in liss:
  ans = ans + (liss[cc] * (liss[cc] - 1) / 2)
print(int(ans))

Buggy python submission (verdict: Time Limit Exceeded):
import collections
N = int(input())
countr = []
liss = []
s = [0] * N
for i in range(N):
  s[i] = input()

for ss in s:
  a = collections.Counter(ss)
  if a in liss:
    ind = liss.index(a)
    countr[ind] += 1
  else:
    liss.append(a)
    countr.append(1)


ans = 0
for cc in countr:
  ans = ans + (cc * (cc - 1) / 2)
print(int(ans))


Fixed submission:
N = int(input())
liss = {}
for i in range(N):
  s = input()
  a = "".join(sorted(s))
  if a in liss:
    liss[a] += 1
  else:
    liss[a] = 1

ans = 0
for cc in liss:
  ans = ans + (liss[cc] * (liss[cc] - 1) / 2)
print(int(ans))

Buggy python submission (verdict: Time Limit Exceeded):
import collections
N = int(input())
countr = []
liss = []
for i in range(N):
  s = input()
  a = collections.Counter(s)
  if a in liss:
    ind = liss.index(a)
    countr[ind] += 1
  else:
    liss.append(a)
    countr.append(1)

ans = 0
for cc in countr:
  ans = ans + (cc * (cc - 1) / 2)
print(int(ans))

Fixed submission:
N = int(input())
liss = {}
for i in range(N):
  s = input()
  a = "".join(sorted(s))
  if a in liss:
    liss[a] += 1
  else:
    liss[a] = 1

ans = 0
for cc in liss:
  ans = ans + (liss[cc] * (liss[cc] - 1) / 2)
print(int(ans))

Buggy python submission (verdict: Runtime Error):
import collections
N = int(input())
countr = []
liss = []
for i in range(N):
  s = input()
  a = collections.Counter(s)
  if a in liss:
    ind = liss.index(a)
    countr[ind] += 1
  else:
    liss.append(a)
    countr[len(liss)-1] = 1

ans = 0
for cc in countr:
  if cc > 1:
    ans = ans + cc * (cc - 1) / 2
print(ans)


Fixed submission:
N = int(input())
liss = {}
for i in range(N):
  s = input()
  a = "".join(sorted(s))
  if a in liss:
    liss[a] += 1
  else:
    liss[a] = 1

ans = 0
for cc in liss:
  ans = ans + (liss[cc] * (liss[cc] - 1) / 2)
print(int(ans))

Buggy python submission (verdict: Runtime Error):
import collections
N = int(input())
s = [0]*N
countr = []
liss = []
for i in range(N):
  s[i] = input()
  a = collections.Counter(s[i])
  if a in liss:
    ind = liss.index(a)
    countr[ind] += 1
  else:
    liss.append(a)
    countr[len(liss)-1] = 1

ans = 0
for cc in countr:
  if cc > 1:
    ans = ans + cc * (cc - 1) / 2
print(ans)


Fixed submission:
N = int(input())
liss = {}
for i in range(N):
  s = input()
  a = "".join(sorted(s))
  if a in liss:
    liss[a] += 1
  else:
    liss[a] = 1

ans = 0
for cc in liss:
  ans = ans + (liss[cc] * (liss[cc] - 1) / 2)
print(int(ans))

Buggy python submission (verdict: Runtime Error):
import collections
N = int(input())
s = [0]*N
counter = {}
for i in range(N):
  s[i] = input()
  a = collections.Counter(s[i])
  if a in counter:
    counter[a] += 1
  else:
    counter[a] = 1

ans = 0
for key in counter:
  if counter[key] > 1:
    ans = ans + counter[key] * (counter[key] - 1) / 2
print(ans)

Fixed submission:
N = int(input())
liss = {}
for i in range(N):
  s = input()
  a = "".join(sorted(s))
  if a in liss:
    liss[a] += 1
  else:
    liss[a] = 1

ans = 0
for cc in liss:
  ans = ans + (liss[cc] * (liss[cc] - 1) / 2)
print(int(ans))