n = gets.to_i

codes = {}

def nc2(n)
  n * (n - 1) / 2
end


res = 0

n.times do
  s = gets.chomp
  code = s.chars.sort.join. to_sym
  if codes.has_key?(code)
    codes[code] += 1
  else
    codes[code] = 1
  end
end

codes.each_value { |i| res += nc2(i) }
puts res