'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('')
  )

  const maps = new Map()
  // strs.forEach(str => {
  let ans = 0

  for (let i = 0; i < strs.length; i++) {
    for (let j = i + 1; j < strs.length; j++) {
      if (strs[i] === strs[j]) ans++
    
    }
  }
 
  console.log(ans)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'))
