function Main(input) {
  var lines = input.split('\n');
  var n = parseInt(lines[0], 10);
  var strings = lines.slice(1);
  var result = 0;
  for (var i=0; i<n-1; i++) {
    for(var j=i+1; j<n; j++) {
      if (strings[i].split('').sort().join() == strings[j].split('').sort().join()) {
        result++;
      }
    }
  }
  //出力
  console.log(result);
}

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