cnt=gets.chomp.to_i
str=[]
cnt.times do |i|
	str[i]=gets.chomp
end
str.length.times do |j|
	arr=[]
	str[j].length.times do |i|
		arr[i]=str[j][i]
	end
	str[j]=arr.sort
end
cnt=0
str.length.times do |i|
	if str[i]!=[""]
		(i+1..str.length).each do |j|
			if str[j]==str[i]
				cnt+=1
			end
		end
		str[i]=[""]
	end
end
puts cnt