n = gets.to_i
pys = []
n.times do
  a =  gets.chomp.split('')
  pys << a.sort.join
end

pys.sort!

count = 0

pys.combination(2) do |item|
   if item[0] == item[1]
   	count += 1
   end
end

puts count