def judge(x1,y1,x2,y2):
	distance=((x1-x2)**2+(y1-y2)**2)**0.5
	if distance>2:
		return False
	else:
		return True

while True:
	n=int(input())
	if n==0:break
	P=[]
	Overlap=[0]*n
	for i in range(n):
		x,y=map(float,input().split(','))
		P.append((x,y))
	for i in range(n):
		for j in range(n):
			if judge(P[i][0],P[i][1],P[j][0],P[j][1]):
				Overlap[i]+=1
	Overlap.sort()
	print(Overlap[-1])