count = gets.to_i

strs = []

count.times.each do
  strs << gets.chomp
end

memo = {}

strs.each do |str|
  s = str.chars.sort.join
  
  if memo.key?(s)
    memo[s] += memo[s] + 1
  else
    memo[s] = 0
  end
end

puts memo.values.inject(:+)