epsilon = 0
while n = gets.to_i
  break if n == 0
  cross = []
  circle = []
  n.times{|i|
    x, y = gets.split(",").map(&:to_f)
    circle.each_with_index{|it, j|
      if (it[0]-x)**2 + (it[1]-y)**2 <= 4.0 + epsilon
        x1 = it[0]-x
        y1 = it[1]-y
        x2y2 = x1**2+y1**2
        a = x2y2*0.5
        b = Math.sqrt(x2y2 - a**2)
        x0 = (a*x1 + y1 * b) / x2y2
        y0 = (a*y1 - x1 * b) / x2y2
        cross << [x0+x, y0+y]
        x0 = (a*x1 - y1 * b) / x2y2
        y0 = (a*y1 + x1 * b) / x2y2
        cross << [x0+x, y0+y]
      end
    }
    circle[i] = [x, y]
  }
  max = 1
  cross.each{|x0, y0|
    cnt = 0
    circle.each{|x1, y1|
      cnt += 1 if (x1-x0)**2 + (y1-y0)**2 <= 1.0 + epsilon
#      puts "#{x0} #{y0} #{x1} #{y1} #{(x1-x0)**2 + (y1-y0)**2}"
    }
    max = cnt if max < cnt
  }
  puts max
end