const Main = input => {
  input = input.split('\n')
    .slice(1)
    .map(v => v.split('').sort((a, b) => a > b).join(''))

  var count = 0
  const obj = {}
  input.forEach(ip => {
    if (!obj.hasOwnProperty(ip)) {
      obj[ip] = 1
      return
    }
    count += obj[ip]
    obj[ip] = obj[ip] + 1
  })

  console.log(count)
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"))