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

class Circle
  include Comparable
  attr_accessor :x, :y, :r
  def initialize(x=0.0, y=0.0, r=1.0)
    @x, @y, @r = x.to_f, y.to_f, r.to_f
  end
  def <=>(c)
    @x!=c.x ? @x<=>c.x : (@y!=c.y ? @y<=>c.y : @r<=>c.r)
  end
  def distance(c)
    Math::hypot(c.x-@x, c.y-@y)
  end
  def touch?(c)
    distance(c) <= @r + c.r
  end
  def crossPoint(c)
    angle = Math::atan2(c.y-@y, c.x-@x)
    d = distance(c)
    add = Math::acos((d**2 + @r**2 - c.r**2) / (2.0*d*@r))
    p1 = Point.new(@x+@r*Math::cos(angle+add), @y+@r*Math::sin(angle+add))
    p2 = Point.new(@x+@r*Math::cos(angle-add), @y+@r*Math::sin(angle-add))
    [p1, p2]
  end
  def include?(p)
    Math::hypot(p.x-@x, p.y-@y) <= @r
  end
end

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