n = gets.chomp.to_i

ana = {}
n.times do
  s = gets.chomp.split('').sort.join
  if ana.has_key?(s.to_sym)
    ana[s.to_sym] += 1
  else
    ana[s.to_sym] = 1
  end
end

res = 0
ana.each do |arr|
  n = arr[1]
  res += n * (n-1) / 2
end

print(res)
