n=gets.to_i
total=0
hash=Hash.new
n.times do 
  s = gets.chomp.split("").sort.join
  if(hash.has_key?(s))
    total += hash[s]
    num = hash[s] + 1
    hash[s] = num
  else
  	hash.store(s,1)
  end
end
puts total