function main(input) {
	var splitted = input.split("\n")
	var num = Number(splitted[0])
	var list = splitted
		.slice(1)
		.map(s => Array.from(s).sort().join(''))
		.sort()
	var count = 0
	var pasts = [
		[list[0]]
	]
	var pastsIndex = 0
	for (var i = 1; i < list.length; i++) {
		if (list[i] === pasts[pastsIndex][0]) {
			count += pasts[pastsIndex].length
			pasts[pastsIndex].push(list[i])
			continue;
		}
		pastsIndex++
		pasts.push([list[i]])
	}
	console.log(count)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));