
import java.util.Scanner



object Main {

  def read(): (Int, IndexedSeq[String]) = {
    val sc: Scanner = new Scanner(System.in)
    val n = sc.nextInt()
    val arr = (1 to n).map { _ =>
      sc.next()
    }
    sc.close()
    (n, arr)
  }


  def solve(n: Int, arr: IndexedSeq[String]): Long = {
    val defaultMap: Map[String, Int] = Map.empty
    val combinationMap = arr.foldLeft(defaultMap) { (stock, str) =>
      val sortedStr = str.sorted
      stock.get(sortedStr) match {
        case None => stock + (sortedStr -> 1)
        case Some(x) => stock + (sortedStr -> (x + 1))
      }
    }
    val combinationCount: Long = combinationMap.values.toSeq.map{ num =>
      num * (num-1L) / 2L
    }.sum

    if(combinationMap.isEmpty) 0
    else combinationCount
  }


  def main(args: Array[String]): Unit = {
    val (n, arr) = read()
    println(solve(n, arr))
  }

}
