n = gets.strip.chomp.to_i

cnt = 0
a=[]
b=[]
n.times do
  a << gets.strip.chomp.chars.sort!
end
a.map{|c| b << c.join("")}
c = {}
b.each do |s|
  if c[s].nil?
    c[s] = 0 
  else
    c[s] += 1
  end
  cnt += c[s]
end
puts cnt