def main
  n = gets.chomp.to_i
  hash = {}
  count = 0
  n.times do
    s = gets.chomp
    h = s.split('').sort.join
    if hash[h]
      count += hash[h]
      hash[h] += 1
    else
      hash[h] = 1
    end
  end
  puts count
end

main if $0 == __FILE__
