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

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

        if(map.contains(str)){
          map(str) = map(str) + 1
        }else{
          map = map.updated(str, 0)
        }
    }
 
    var max: Long = map.values.map(i => (0 to i).sum).sum
 
    println(max)
  }
}