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

    val all = (0 until n).map{
      i =>
        val s = io.StdIn.readLine().toString
        s
    }

    val groupMap = all.map{
      s =>

        val group = s.toCharArray.groupBy(i => i).map{
          case(c, arr) =>
            (c, arr.length)
        }

        group
    }.toArray

    groupMap.foreach{println}


    var map = mutable.Map.empty[scala.collection.immutable.Map[Char, Int], Int]

    groupMap.foreach{
      m =>
        if(map.contains(m)){
          val num = map(m)
          map(m) = map(m) + 1
        }else{

          map = map.updated(m, 0)
        }
    }

    val max: Long = map.values.sum + map.count(i => i._2 != 0) - 1

    println(max)
  }
}