function Main(input) {
  lines = input.split('\n')
  N = lines.shift() * 1
  ans = 0
  for (i=0; i<N; i++) {
      lines[i] = lines[i].split('').sort().join('')
  }
  for (i=0; i<N; i++) {
      for (j=i+1; j<N; j++) {
          if (lines[i] == lines[j]) {
              ans++
          }
      }
  }
  console.log(ans)
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"))