n = gets.chomp.to_i
s = []
n.times do
  s << gets.chomp.split("").sort
end
cnt = 0
s.sort!
ss = []
k = 0
n.times do |i|
  if s[i] == ss
    k += 1
  else
    cnt += k * (k+1) / 2
    k = 0
    ss = s[i]
  end
end
cnt += k * (k+1) / 2
puts cnt
