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 p = s[i].split``.sort().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')));
