N = gets.chomp.to_i
s = []
N.times do
  s << gets.chomp
end

h = {}
s.each do |ss|
  sorted_s = ss.split('').sort.join
  h[sorted_s] ||= 0
  h[sorted_s] += 1
end
  
r = 0
h.each do |_, v|
  if v >= 2
    r += v * (v - 1) / 2
  end
end

p r