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 mm = scala.collection.mutable.HashMap.empty[String, Long] ++
      s.map{ a => a.split("").sorted.mkString("")}.groupBy(s => s).mapValues( s => s.length.toLong)
    val result = mm.values
      .map { v => v * (v -1) / 2 }
      .sum
    println(result);
  }
}

