n=gets.to_i
s=[]
n.times do |i|
  s[i]=gets.chomp.chars
  s[i].sort!
end
s.sort!
a=s.uniq
ans=[]
for i in 0...a.size
  wa=s.count(a[i])
  ans << wa-1 if wa>1
end
for i in 0...ans.size
  ans[i]=(1..ans[i]).inject(0){|sum,k|sum+=k} if ans[i]>1
end
puts ans.sum
