N = gets.chomp.to_i
strings = []
N.times { strings.push(gets.chomp) }

strings.map! { |s| s.chars.sort.join("") }
strings.sort!

ans = 0
count = 0
s = ""
strings.each do |str|
  if str == s
    count += 1
    next
  end

  s = str
  ans += count * (count - 1) / 2 if count >= 2
  count = 1
end

ans += count * (count - 1) / 2 if count >= 2
puts ans
