n = gets.chomp.to_i
obj = {}

n.times do
  str = gets.chomp.chars.sort.join
  if obj[str]
    obj[str] += 1
  else
    obj[str] = 1
  end
end

count = 0;
obj.each do |key, value|
  next if value == 1
  (value - 1).times { |i| count += i + 1 }
end

puts count
