cnt=gets.chomp.to_i
str=[]
strCnt={}
cnt.times do |j|
	arr=[]
	str[j]=gets.chomp
	str[j].length.times do |i|
		arr[i]=str[j][i]
	end
	str[j]=arr.sort.join
	strCnt[str[j]]||=0
	strCnt[str[j]]+=1
end
cnt=0
strCnt.each_value do |i|
	cnt += i * (i-1) / 2
end
puts cnt