n=gets.to_i
ss=n.times.map{gets.chomp.split("").sort}.sort
cur=1
ans=0
(n-1).times do |i|
   if ss[i]==ss[i+1]
     cur+=1
   else
     ans+=(cur*(cur-1))/2
     cur=1
   end
 end
 ans+=(cur*(cur-1))/2
 puts ans
