'use strict';
const main = input => {
  const n = parseInt(input[0], 10);
  input.shift();
  input.pop();
  let s = new Array(n);
  s = input;
  s = s.map(val => [...val].sort((x,y)=>x>y?1:-1).toString());
  let ans = 0;
  for(let i=0; i<n-1; i++) {
    for(let j=i+1; j<n; j++) {
      ans += s[i]==s[j]?1:0;
    }
  }
  console.log(ans);
};
main(require("fs").readFileSync("/dev/stdin", "utf8").split('\n'));