output_list = []

while 1:
	n = int(raw_input())
	if n == 0:
		break
	
	point_list = [map(float, raw_input().split(",")) for i in range(n)]
	
	max = 1
	for p in point_list:
		sum = 0
		for other in point_list:
			if (p[0]-other[0])**2 + (p[1]-other[1])**2 <= 2.0**2:
				sum += 1
				
			if sum > max:
				max = sum

	output_list.append(max)
	
for s in output_list:
	print s