n = gets.to_i
s_array = Array.new(n)
for i in 0..(n - 1) do
  s_array[i] = gets.split('').sort.join('')
end
s_uniq = s_array.uniq
cnt = 0
s_uniq.each { |s| cnt += (0..s_array.count(s) - 1).to_a.sum }
p cnt