function Main(input) {
	input = input.split("\n");
	tmp = input[0].split(" ");
	var anagrams = new Array(tmp);
	var count = {};
	var alphabet = new Array(10);
	var answer = 0;
	for(var i=0;i<tmp;i++){
      alphabet = input[i+1].split("");
      alphabet.sort();
      anagrams[i] = alphabet.join("");
      if( anagrams[i] in count){
        answer += count[anagrams[i]];
        count[anagrams[i]]++;
      }else{
        count[anagrams[i]] = 1;
      }
    }
	console.log(answer);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));