=begin
N
s1
...
sn
=end

n = gets.chomp.to_i
ss = n.times.map do
  s = gets.chomp
  s.each_char.sort.join
end

h = {}

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

def total(n)
  (n + 1) * n / 2
end

res = 0

h.each do |k, v|
  if v < 2
    next
  end

  res += total(v - 1)
end

puts res
