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