object Main{
  def main(args: Array[String]) : Unit = {
    val arr1 = io.StdIn.readLine().split(' ')
    val n = arr1(0).toInt
    var mm = scala.collection.mutable.HashMap.empty[String, Int]

    (0 until n).foreach{
      i =>
        val s = io.StdIn.readLine().toString
        val str = s.sorted

        if(mm.contains(str)){
          mm.update(str) = mm(str) + 1
        }else{
          mm.update(str) = 0
        }
    }

    var max: Long = mm.values.map(i => (0 to i).sum).sum

    println(max)
  }
}