object Main{
  def main(args: Array[String]) : Unit = {
    val sc = new java.util.Scanner(System.in)
    val n = sc.nextInt
    val s = (1 to n).map{sc.next}
    val result =  s.map{ a => a.split("").sorted.mkString("")}
      .groupBy(s => s)
      .values
      .map { v => v.size.toLong }
      .map { v => v * (v -1) / 2 }
      .sum
    println(result);
  }
}

