import math
while True:
    n=input()
    if n==0:break
    L=[map(float,raw_input().split(",")) for i in range(n)]
    table=[set() for i in range(n)]
    for i in range(n):
        for j in range(n):
            d=math.sqrt(pow(L[i][0]-L[j][0],2)+pow(L[i][1]-L[j][1],2))
            if d<=2:
                table[i].add(j)
    num=0
    for i in range(n):
        num=max(num,len(table[i]))
    print num