import java.util.Scanner

object Main extends App {

  val sc = new Scanner(System.in)

  val n = sc.nextInt
  val sl = Seq.fill(n)(sc.next)

  val constructions =
    sl.map{ s =>
      s.foldLeft(Map.empty[Char,Int]) { case (m, ch) =>
        if (m.isDefinedAt(ch)) m.updated(ch, m(ch) + 1)
        else m + (ch -> 1)
      }
    }
  
  val duplicateNum =
    constructions
    .zipWithIndex
    .groupBy(_._1)
    .mapValues(_.size)

  val res = duplicateNum
    .foldLeft(0L){ case (acc, m) =>
      val cnt = m._2
        acc + cnt * (cnt - 1) / 2
    }
  println(res)
}

