n = gets.to_i
l = []
n.times do
  s = gets.chars
  s.sort!
  l << s
end
l.sort!
idx = 0
ans = 0
while idx < n do
  sub = 0
  while idx + sub < n && l[idx] == l[idx + sub] do
    sub += 1
  end
  ans += sub * (sub - 1) / 2
  idx += sub
end
puts ans

