include Math
def calc1(a, b)
  (a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2
end
def calc2(a, b)
  x = sqrt(calc1(a, b))
  y = sqrt(1.0 - (x/2) ** 2)
  [(a[0] + b[0]) / 2, (a[1] + b[1]) / 2, (a[1] - b[1]) / x * y, (b[0] - a[0]) / x * y]
end
while n = gets.to_i
  break if n == 0
  dots = Array.new(n)
  points = Array.new
  n.times { |i| dots[i] = gets.split(",").map(&:to_f) }
  n.times do |i|
    ((i+1)...n).each do |j|
      if calc1(dots[i], dots[j]) <= 4.0
        a, b, c, d = calc2(dots[i], dots[j])
        points << [a + c, b + d] << [a - c, b - d]
      end
    end
  end
  ret = 0
  points.each do |p|
    px, py = p
    cnt = 0
    dots.each do |d|
      dx, dy = d
      cnt += 1 if (dx - px) ** 2 + (dy - py) ** 2 <= 1.0
    end
    ret = cnt if cnt > ret
  end
  p ret
end