import math
while True:
    n = input()
    if (n == 0):
        break
    d = []
    EPS = 10 ** (-9)

    for i in range(n):
        a = map(float, raw_input().split(","))
        x = a[0]
        y = a[1]
        d.append([y,x])
    ans = 1
    for i in range(n):
        sheets = 1
        for j in range(n):
            if (i == j):continue
            dist = (d[i][0] - d[j][0]) ** 2  + (d[i][1] - d[j][1]) ** 2
            format(dist, ".12g")
            if (dist <= 4.0 + EPS):
                sheets += 1
        ans = max(ans, sheets)
    print ans