'use strict'

function main(input) {
  input = input.trim().split('\n')
  const N = ~~input[0]
  const strs = input.slice(1).map(v =>
    v
      .split('')
      .sort()
      .join('')
  )
  let ans = 0

  const maps = new Map()
  for (let i = 0; i < strs.length; i++) {
    if (maps.has(strs[i])) { 
      ans += maps.get(strs[i])
      let count = maps.get(strs[i]) + 1 
      maps.set(strs[i], count)
    } else {
      maps.set(strs[i], 1)
    }
  } 
  console.log(ans)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'))
