class Circle
  attr_accessor :x, :y
  def initialize(x=0.0, y=0.0)
    @x, @y = x.to_f, y.to_f
  end

  def distance(c)
    Math::hypot(c.x-@x, c.y-@y)
  end
  def crosspoints(c)
    d = distance(c)
    a = Math::atan2(c.y-@y, c.x-@x)
    # 1 is radius (of each circle)
    dec = Math::acos((d**2 + 1**2 - 1**2)/(2*d*1))
    [dec, -dec].map do |dec|
      [@x + 1*Math::cos(a-dec), @y + 1*Math::sin(a-dec)]
    end
  end
  def cover?(x, y)
    Math::hypot(x-@x, y-@y) <= 1.0
  end
end

while (n = gets.to_i) != 0
  circles = []
  allCrosspoints = []
  answer = 1

  n.times do |t|
    # omajinai
    x, y = gets.chomp.split(",").map{|n| n.to_f}
    circles[t] = Circle.new(x, y)
    # should use circles.push(Circle.new(x, y))
  end

  circles.each do |c1|
    circles.each do |c2|
      next if c1 == c2
      next if c1.distance(c2) > 2.0
      # p c1, c2

      allCrosspoints.push(c1.crosspoints(c2))
      # p debug, allCrosspoints, "- - -"
    end
  end

  allCrosspoints.flatten(1).each do |x, y|
    # p x, y
    covercnt = 0
    circles.each do |c|
      covercnt += 1 if c.cover?(x, y)
    end
    answer = covercnt if covercnt > answer
  end
end

puts answer