function Main(input) {
  var output = 0;
  var list = [];
  var list2 = [];
  
  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 < 10; j++){
      tmpList.push(tmp.slice(j, j + 1));
    }
    tmpList.sort();
    list2.push(tmpList);
  }
  //console.log(list2);
  
  for(var i = 0; i < list2.length; i++){
    for(var j = i + 1; j < list2.length; j++){
      var tmp1 = JSON.stringify(list2[i]);
      var tmp2 = JSON.stringify(list2[j]);
      if(tmp1 == tmp2){
         output++;
         }
    }
  }
  console.log(output);
}

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