object Main{
  def main(args: Array[String]) : Unit = {
    val sc = new java.util.Scanner(System.in)
    val n = sc.nextInt
    val hash = scala.collection.mutable.HashMap.empty[String,Long].withDefault(_ => 0.toLong)
    (1 to n)
      .map{_ => sc.next.split("").sorted.mkString("")}
      .foreach(s => hash(s) = hash(s)+1)

    val result = hash.values.map(v => v * (v - 1) /2).sum
    println(result);
  }
}

