'use strict'
function Main(input) {
  input = input.split('\n');
  input.shift();
  const array2 = input.map(e => {
    e.split('').reduce((a, e) => {
      if(!a[e]) {
        a[e] = 1;
      } else {
        ++a[e];
      }
    }, {});
  });
  var count = 0;
  for (var i = 0; i < array2.length; i++) {
    for (var k = i + 1; k <= array2.length; k++) {
      if (array2[i] == array2[k]) {
        ++count;
      }
    }
  }
  console.log(count);
}

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