n = gets.chomp.to_i
#k,x = gets.chomp.split().map(&:to_i)

s = []
n.times do
  s.push gets.chomp.split('').sort.join('')
end

s.sort!

ans = 0
current = ''
count = 0
s.each do |e|
  if current == e
    count += 1
  else
    ans += count * (count - 1) / 2 if count >= 2
    current = e
    count = 1
  end
end
ans += count * (count - 1) / 2 if count >= 2


puts ans
