Buggy python submission (verdict: Time Limit Exceeded):
"""
N = list(map(int,input().split()))
S = [str(input()) for _ in range(N)]
S = [list(map(int,list(input()))) for _ in range(h)] 
print(*S,sep="")
"""

import sys
sys.setrecursionlimit(10**6)
input = lambda: sys.stdin.readline().rstrip()
inf = float("inf") # 無限

n = int(input())

data = []
for _ in range(n):
    data.append("".join(sorted(input())))
# print(data)
data.sort()
# print(data)

answer = 0
for i in range(0,n-1):
    for j in range(i+1,n):
        if data[i] == data[j]:
            answer+=1
        else:
            break
print(answer)

Fixed submission:
"""
N = list(map(int,input().split()))
S = [str(input()) for _ in range(N)]
S = [list(map(int,list(input()))) for _ in range(h)] 
print(*S,sep="")
"""

import sys
sys.setrecursionlimit(10**6)
input = lambda: sys.stdin.readline().rstrip()
inf = float("inf") # 無限

n = int(input())

data = {}
for _ in range(n):
    temp = "".join(sorted(input()))
    # print(temp)
    if temp in data.keys():
        data[temp] += 1
    else:
        data[temp] = 1
# print(data)

answer = 0
for num in data.values():
    answer += (num*(num-1))//2
print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
num = int(input())
data = []
for _ in range(num):
    data.append(sorted(input()))
data = sorted(data)
count = 0
for i in range(num):
    for j in range(i+1,num):
        if data[i] == data[j]:
            count+=1
        else:
            break
print(count)

Fixed submission:
"""
N = list(map(int,input().split()))
S = [str(input()) for _ in range(N)]
S = [list(map(int,list(input()))) for _ in range(h)] 
print(*S,sep="")
"""

import sys
sys.setrecursionlimit(10**6)
input = lambda: sys.stdin.readline().rstrip()
inf = float("inf") # 無限

n = int(input())

data = {}
for _ in range(n):
    temp = "".join(sorted(input()))
    # print(temp)
    if temp in data.keys():
        data[temp] += 1
    else:
        data[temp] = 1
# print(data)

answer = 0
for num in data.values():
    answer += (num*(num-1))//2
print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
num = int(input())
data = []
for _ in range(num):
    data.append(sorted(input()))
data = sorted(data)
count = 0
for i in range(num):
    tmp = data[i]
    for j in range(i+1,num):
        if tmp == data[j]:
            count+=1
        else:
            break
print(count)

Fixed submission:
"""
N = list(map(int,input().split()))
S = [str(input()) for _ in range(N)]
S = [list(map(int,list(input()))) for _ in range(h)] 
print(*S,sep="")
"""

import sys
sys.setrecursionlimit(10**6)
input = lambda: sys.stdin.readline().rstrip()
inf = float("inf") # 無限

n = int(input())

data = {}
for _ in range(n):
    temp = "".join(sorted(input()))
    # print(temp)
    if temp in data.keys():
        data[temp] += 1
    else:
        data[temp] = 1
# print(data)

answer = 0
for num in data.values():
    answer += (num*(num-1))//2
print(answer)

Buggy python submission (verdict: Runtime Error):
num = int(input())
data = []
for _ in range(num):
    tmp = input()
    data.append(tmp.sort())
data = data.sort()
count = 0
for i in range(num):
    tmp = data[i]
    for j in range(i+1,num):
        if tmp == data[j]:
            count+=1
        else:
            break
print(count)

Fixed submission:
"""
N = list(map(int,input().split()))
S = [str(input()) for _ in range(N)]
S = [list(map(int,list(input()))) for _ in range(h)] 
print(*S,sep="")
"""

import sys
sys.setrecursionlimit(10**6)
input = lambda: sys.stdin.readline().rstrip()
inf = float("inf") # 無限

n = int(input())

data = {}
for _ in range(n):
    temp = "".join(sorted(input()))
    # print(temp)
    if temp in data.keys():
        data[temp] += 1
    else:
        data[temp] = 1
# print(data)

answer = 0
for num in data.values():
    answer += (num*(num-1))//2
print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
num = int(input())
data = []
for _ in range(num):
    data.append(sorted(input()))
count = 0
for i in range(num):
    tmp = data[i]
    for j in range(i+1,num):
        if tmp == data[j]:
            count+=1
print(count)

Fixed submission:
"""
N = list(map(int,input().split()))
S = [str(input()) for _ in range(N)]
S = [list(map(int,list(input()))) for _ in range(h)] 
print(*S,sep="")
"""

import sys
sys.setrecursionlimit(10**6)
input = lambda: sys.stdin.readline().rstrip()
inf = float("inf") # 無限

n = int(input())

data = {}
for _ in range(n):
    temp = "".join(sorted(input()))
    # print(temp)
    if temp in data.keys():
        data[temp] += 1
    else:
        data[temp] = 1
# print(data)

answer = 0
for num in data.values():
    answer += (num*(num-1))//2
print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
num = int(input())
data = []
for _ in range(num):
    data.append(sorted(input()))
count = 0
for i in range(num):
    for j in range(i+1,num):
        if data[i] == data[j]:
            count+=1
print(count)

Fixed submission:
"""
N = list(map(int,input().split()))
S = [str(input()) for _ in range(N)]
S = [list(map(int,list(input()))) for _ in range(h)] 
print(*S,sep="")
"""

import sys
sys.setrecursionlimit(10**6)
input = lambda: sys.stdin.readline().rstrip()
inf = float("inf") # 無限

n = int(input())

data = {}
for _ in range(n):
    temp = "".join(sorted(input()))
    # print(temp)
    if temp in data.keys():
        data[temp] += 1
    else:
        data[temp] = 1
# print(data)

answer = 0
for num in data.values():
    answer += (num*(num-1))//2
print(answer)