n=gets.to_i
c=Array.new(n).map{Array.new(26,0)}
n.times do |i|
  si=gets.chomp.split("")
  10.times do |j|
    c[i][si[j].ord-97]+=1
  end
end
c.sort!
ans=0
cur=1
n.times do |i|
  if c[i]==c[i+1]
    cur+=1
  else
    ans+=(cur*(cur-1))/2
    cur=1
  end
end
puts ans
