def combi_2(n)
  n * (n - 1)/2
end

n = gets.to_i
ss = Array.new(n) { |i| gets.chomp }
ans = 0

group = ss.group_by{|v| v.chars.sort.join}
group.each do |key, val|
  ans += combi_2(val.size)
end

puts ans