console.log((args=>{
  const [n,...s] = args.trim().split`\n`;
  const N = n|0;
  const m = new Map();
  for ( let i = 0; i < N; i++ ) {
    const e = Array(26).fill(0);
    for ( let j = 0; j < 10; j++ ) e[s[i].charCodeAt(j)-97]++;
    let p = e.map(c=>c.toString(11)).join``;
    m.set( p, (m.get(p)|0) + 1 );
  }
  let a = 0;
  for ( const [,v] of m ) a += v*(v-1)/2;
  return `${a}`;
})(require('fs').readFileSync('/dev/stdin', 'utf8')));
