def is_over(a,b):
	return True if (a[0]-b[0])**2 + (a[1]-b[1])**2 < 4.0+1.0e-12 else False

mx = 0	
while True:
	n = int(raw_input())
	if n == 0: break
	seals = [map(float, raw_input().split(",")) for i in range(n)]
	overs = []
	for i in range(n):
		over = []
		for j in range(n):
			if is_over(seals[i],seals[j]):
				over.append(j)
		overs.append(over)
	for over in overs:
		set_over = set(over)
		for i in over:
			set_over = set_over&set(overs[i])
		if len(set_over) > mx:
			mx = len(set_over)
print mx