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 = map.maxBy(i => i._2)
 
    println(max._2)
  }
}