n = gets.to_i
ss = []
n.times do
  ss << gets.chomp.chars.sort.join
end

s_h = Hash.new(0)

ss.each do |s|
  s_h[s] += 1
end

def combi(n,k)
  return 0 if n < 2
  k=n-k if 2*k > n
  return 1 if k == 0
  ((n-k+1)..n).reduce(&:*)/((1..k).reduce(&:*))
end

# puts s_h

ans = 0
s_h.each do |k, v|
  ans += combi(v, 2)
end

puts ans

# ans = 0
# (0..n-2).each do |i|
#   ((i+1)..(n-1)).each do |j|
#     if ss[i] == ss[j]
#       ans += 1
#     end
#   end
# end

# puts ans

