n = gets.chomp.to_i
kq = {}
(1..n).each do |i|
  sorted = gets.chomp.split("").sort.join("")
  if kq[sorted] != nil && kq[sorted] != 1
    kq[sorted] = kq[sorted] + 1
  else
    kq[sorted] = 1
  end
end
sum = 0
kq.map {|key, value| sum+= value*(value-1)/2}
puts sum