N = gets.to_i
words = []
ans = 0
pair = {}
N.times do
  words << gets.chomp.split('').sort.join("")
end
words.each do |w|
  if pair.has_key?(w)
    ans += pair[w]
    pair[w] += 1
  else
    pair[w] = 1
  end
end
puts ans