def dist(x1, y1, x2, y2)
  Math.sqrt((x1 - x2)**2 + (y1 - y2)**2)
end

while line = gets
  n = line.chomp.to_i
  break if n == 0

  points = []

  n.times do
    points << gets.chomp.split(',').map(&:to_f)
  end

  counts = Array.new(points.length, 1)

  for i in 0...(points.length - 1) do
    a = points[i]
    for j in (i + 1)...(points.length) do
      b = points[j]
      if dist(a[0], a[1], b[0], b[1]) - 2.0 <= 1e-9
        counts[i] += 1
        counts[j] += 1
      end
    end
  end

  puts counts.max
end