def fact(n)
  (1..n).to_a.reduce(1, &:*)
end

N = gets.to_i
table = Hash.new { 0 }
s_list = N.times.map { gets.chomp.chars }
s_list.each do |s|
  table[s.sort] += 1
end

ans = 0
table.each do |k, v|
  next if v == 0
  ans += (fact(v) / (fact(2) * fact(v - 2)))
end
puts ans
