n = gets.to_i
arr = []
n.times do
  arr.push(gets.chomp.chars.sort.join)
end
arr.sort!
count = 0
suc_count = 0
i = 0
while i < arr.size-1
  if arr[i] == arr[i+1]
    suc_count += 1
    count += suc_count
  else
    suc_count = 0
  end
  i += 1
end
puts count