'use strict';
function main(input) {
  const args =input.split('\n'),
        N = parseInt(args[0]),
        S = args.slice(1, N+1);
  let register = new Map();
  let cnt = 0;
  for (let s of S) {
    let sorted = s.split('').sort().join();
    if (!register.has(sorted)) {
      register.set(sorted, 1);
    } else {
      let tmp = register.get(sorted);
      cnt += tmp;
      register.set(sorted, tmp+1);
    }
  }
  console.log(cnt);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));