n = gets.to_i
s = []
n.times do |i|
  s.push gets.chomp.to_s;
end

ret = 0
sorted_s = []
ans = {}
s.each do |t|
  sorted = t.split("").sort!.join
  if ans.assoc(sorted)
    ret += ans[sorted]
    ans[sorted] += 1
  else
    ans[sorted] = 1
  end
end
# s ["acb", "bac"]
# sorted_s ["abc", "abc"]

puts ret
