EPS = 1e-9
class Circle
  attr_accessor :x, :y, :r
  def initialize(x, y, r)
    @x = x; @y = y; @r = r
  end
  def touch?(c)
    Math::hypot(@x-c.x, @y-c.y) - @r - c.r < EPS
  end
end

while (n = gets.to_i) != 0 do
  answer = 0
  seal = Array.new
  n.times do
    x, y = gets.split(",").map(&:to_f)
    r = 1.0
    seal.push(Circle.new(x, y, r))
  end
  seal.each do |s1|
    count = 0
    seal.each do |s2|
      count += 1 if s1.touch?(s2)
    end
    answer = [answer, count].max
  end
  p answer
end