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++){
    list.push(input.split("\n")[i]);
  }
  
  for(var i = 0; i < list.length; i++){
    var tmp = list[i];
    var tmpList = [];
    for(var j = 0; j < tmp.length; j++){
      tmpList.push(tmp.slice(j, j +1));
    }
    tmpList.sort();
    var tmp2 = "";
    for(var j = 0; j < tmpList.length; j++){
      tmp2 += tmpList[j];
    }
    list2.push(tmp2);
    if(list3.indexOf(tmp2) == -1){
       list3.push(tmp2);
       }
    if(outputList[tmp2] == null){
       outputList[tmp2] = 0;      
       }else{
        outputList[tmp2]++; 
       }
  }
  
  
  for(var i = 0; i < list3.length; i++){
    output += pin(outputList[list3[i]]);
  }
  
  console.log(output);
  function pin(val){
    if(val == 0){
       return 0;
       }
    var ret = 0;
    for(var i = 1; i <= val; i++){
      ret += i;
    }
    return ret;
  }
}

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