'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()
  strs.forEach(str => {
    if (maps.has(str)) {
      maps.set(str, maps.get(str) + 1)
    } else {
      maps.set(str, 0)
    }
  })
  for (let [k, v] of maps) {
    ans += v
  }
  console.log(ans)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'))
