N=gets.to_i
hash = {}
N.times do |n|
  sum = gets.rstrip.chars.sort.join
unless hash.has_key? sum
  hash[sum] = []
end
  hash[sum].push(n)
end
count = hash.values.map{|a| a.combination(2).size }.reduce(:+)
print count