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

    for i in range(n):
        a = map(float, raw_input().split(","))
        x = a[0]
        y = a[1]
        d.append([y,x])
    ans = 1
    for Y in range(0, 100):
        for X in range(0, 100):
            y1 = 1.0 * Y / 10
            x1 = 1.0 * X / 10
            sheet = 0
            for i in range(n):
                dist = (d[i][0] - y1) ** 2 + (d[i][1] - x1) ** 2
                if (dist <= 1.0):
                    sheet += 1
            ans = max(ans, sheet)
    print ans