object Main {
  def readLine(): String = scala.io.StdIn.readLine()
  def readLines(n: Int): Seq[String] = List.fill(n)(readLine())
  def readLinesTo(end: String, ss: Seq[String] = Nil): Seq[String] = readLine() match {
    case s if s.trim == end => ss
    case s => readLinesTo(end, ss :+ s)
  }

  def main(args: Array[String]): Unit = {
    case class Xy(string: String) {
      import scala.math.{pow, sqrt}
      val Array(x: Double, y: Double) = string.split(',').map(_.toDouble)
      def overLap(xy: Xy): Boolean = sqrt(pow(xy.x - x, 2) + pow(xy.y - y, 2)) < 2
    }
    val n: Int = readLine().toInt
    val xys: Seq[Xy] = readLines(n).takeWhile(_.trim != "0").map(Xy)
    println(xys.map(xy => xys.count(xy.overLap)).max)
  }
}