require 'set'

n = gets.to_i

s_list = []
n.times do
  s_list << gets.chomp
end

count = 0
s_list.each do |s|
  s_list.each do |t|
    if s == t
      next
    end
    
    if s.split('').sort == t.split('').sort
      count += 1
    end
  end
end

puts count / 2