from collections import Counter,defaultdict,deque

import sys,heapq,bisect,math,itertools,string,queue

sys.setrecursionlimit(10**8)

mod = 10**9+7

def inp(): return int(sys.stdin.readline())

def inpl(): return list(map(int, sys.stdin.readline().split()))

def inpl_str(): return list(sys.stdin.readline().split())

def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))



def conb(n,r): 

    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n = inp()

s = []

for i in range(n):

    tmp = list(eval(input()))

    s.append(sorted(tmp))

s.sort()

# print(s)

cnt = []

tmp = 0

for i in range(n-1):

    if s[i] == s[i+1]:

        tmp += 1

    elif tmp != 0:

        cnt.append(tmp)

        tmp = 0

if tmp != 0:

    cnt.append(tmp)

# print(cnt)

res = 0

for i in cnt:

    res += conb(i+1, 2)

print(res)
from collections import Counter,defaultdict,deque

from heapq import heappop,heappush,heapify

import sys,bisect,math,itertools,fractions,pprint

sys.setrecursionlimit(10**8)

mod = 10**9+7

INF = float('inf')

def inp(): return int(sys.stdin.readline())

def inpl(): return list(map(int, sys.stdin.readline().split()))

def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))



n = inp()

d = defaultdict(int)

for i in range(n):

    s = list(eval(input()))

    s.sort()

    tmp = ''.join(s)

    d[tmp] += 1

res = 0

for key in list(d):

    v = d[key]

    res += v*(v-1)//2

print(res)
from collections import Counter, defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue

sys.setrecursionlimit(10**8)
mod = 10**9 + 7


def inp():
    return int(sys.stdin.readline())


def inpl():
    return list(map(int, sys.stdin.readline().split()))


def inpl_str():
    return list(sys.stdin.readline().split())


def inpln(n):
    return list(int(sys.stdin.readline()) for i in range(n))


def conb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


n = inp()
s = []
for i in range(n):
    tmp = list(eval(input()))
    s.append(sorted(tmp))
s.sort()
# print(s)
cnt = []
tmp = 0
for i in range(n - 1):
    if s[i] == s[i + 1]:
        tmp += 1
    elif tmp != 0:
        cnt.append(tmp)
        tmp = 0
if tmp != 0:
    cnt.append(tmp)
# print(cnt)
res = 0
for i in cnt:
    res += conb(i + 1, 2)
print(res)

from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
import sys, bisect, math, itertools, fractions, pprint

sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")


def inp():
    return int(sys.stdin.readline())


def inpl():
    return list(map(int, sys.stdin.readline().split()))


def inpln(n):
    return list(int(sys.stdin.readline()) for i in range(n))


n = inp()
d = defaultdict(int)
for i in range(n):
    s = list(eval(input()))
    s.sort()
    tmp = "".join(s)
    d[tmp] += 1
res = 0
for key in list(d):
    v = d[key]
    res += v * (v - 1) // 2
print(res)

-import sys, heapq, bisect, math, itertools, string, queue +from heapq import heappop, heappush, heapify +import sys, bisect, math, itertools, fractions, pprint +INF = float("inf") -def inpl_str(): -    return list(sys.stdin.readline().split()) - - -def conb(n, r): -    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r)) - - -s = [] +d = defaultdict(int) -    tmp = list(eval(input())) -    s.append(sorted(tmp)) -s.sort() -# print(s) -cnt = [] -tmp = 0 -for i in range(n - 1): -    if s[i] == s[i + 1]: -        tmp += 1 -    elif tmp != 0: -        cnt.append(tmp) -        tmp = 0 -if tmp != 0: -    cnt.append(tmp) -# print(cnt) +    s = list(eval(input())) +    s.sort() +    tmp = "".join(s) +    d[tmp] += 1 -for i in cnt: -    res += conb(i + 1, 2) +for key in list(d): +    v = d[key] +    res += v * (v - 1) // 2