function Main(input) {
  var output = 0;
  var list = [];
  var list2 = [];
  var list3 = [];
  var outputList = {};
  for(var i = 1; i <= parseInt(input.split("\n")[0]); i++){
    var tmp = input.split("\n")[i].split("");
    tmp.sort();
    var tmp2 = tmp.join();
    if(outputList[tmp2] == null){
       outputList[tmp2] = 1;
    }else{
       output += outputList[tmp2];
       outputList[tmp2]++;  
    }
  }
  console.log(output);
  
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
