# coding: utf-8

n = gets.to_i

a = []
b = []
ret = 0
for i in 0..n-1 do
  s=gets.chomp

  ary = []
  for j in 0..s.length-1 do
    ary.push(s[j].ord)
  end
  ary = ary.sort
  f = true
  for j in 0..a.length-1 do
    if a[j] == ary then
      b[j]+=1
      ret += b[j]
      f=false
      break
    end
  end
  if f then
    a.push(ary)
    b.push(0)
  end
end

print(ret)