from math import sqrt
EPS = 10**(-8)
N = 100
def intersection(p, q, s, t):
    a = 2*(p-s)
    b = 2*(q-t)
    c = (p**2+q**2) - (s**2+t**2)
    A = a**2 + b**2
    Bx = p*b**2 + a*(c-q*b)
    Cx = (p**2+q**2-1)*b**2 - 2*b*c*q + c**2
    Dx = Bx**2-A*Cx
    #By = q*a**2 + b*(c-p*a)
    #Cy = (p**2+q**2-1)*a**2 - 2*a*c*p + c**2
    #Dy = By**2-A*Cy
    x0 = (-sqrt(Dx)+Bx)/A; y0 = (-x0*a + c)/b;
    x1 = (sqrt(Dx)+Bx)/A; y1 = (-x1*a + c)/b;
    return x0, y0, x1, y1
def dist(p, q, s, t):
    return (p-s)**2 + (q-t)**2
x,y = [0.0]*N,[0.0]*N
xi = [0.0]*2; yi = [0.0]*2
while True:
    n = input()
    if n==0:
        break
    ans = 1
    for i in xrange(n):
        x[i], y[i] = map(float, raw_input().split(','))
    for i in xrange(n):
        for j in xrange(i+1, n):
            rr = dist(x[i], y[i], x[j], y[j])
            if rr<4.00+EPS:
                if rr<EPS:
                    cnt = 2
                    for k in xrange(n):
                        if k==i or k==j:
                            continue
                        if dist(x[i], y[i], x[k], y[k])<1.00+EPS:
                            cnt += 1
                    ans = max(ans, cnt)
                else:
                    xi[0], yi[0], xi[1], yi[1] = intersection(x[i], y[i], x[j], y[j])
                    for t in xrange(2):
                        #print xi[t],yi[t], "(", i, j,")"
                        cnt = 2
                        for k in xrange(n):
                            if k==i or k==j:
                                continue
                            rri = dist(xi[t], yi[t], x[k], y[k])
                            if rri<1.00+EPS:
                                cnt += 1
                                #print k, rri
                        #print ">>",cnt
                        ans = max(ans, cnt)
    print ans