'use strict'
function main(inp) {
  inp = inp.trim().split('\n')
  const N = Number(inp.shift())
  inp = inp.map(S => {
    return S.split('').sort().join('')
  }).sort();

  const fac = n => {
    let fac = 1;
    for (let i = 1; i <= n; i++) {
      fac = fac * i;
    }
    return fac
  }

  let ans = 0
  let obj = {}

  for (let i = 0; i < N; i++) {
    if (!(inp[i] in obj)) obj[inp[i]] = 0
    obj[inp[i]]++
  }

  Object.keys(obj).forEach(key => {
    if(obj[key] > 1) {
      ans += fac(obj[key]) / 2
    }
  })
  console.log(ans)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
