import math
n = input()
pos = [map(float, raw_input().split(",")) for i in xrange(n)]
ans = 0
px = [0.0]*2; py = [0.0]*2
sig = [1.0, -1.0]
for i in xrange(n):
    for j in xrange(i+1, n):
        rx = pos[j][0] - pos[i][0]
        ry = pos[j][1] - pos[i][1]
        l = math.sqrt(rx**2 + ry**2)/2.0
        if l>1.000000000:
            continue
        lr = math.sqrt(1-l**2)
        for s in xrange(2):
            if l>0.0:
                px[s] = (l*rx - sig[s]*lr*ry)/(2.0*l) + pos[i][0]
                py[s] = (l*ry + sig[s]*lr*rx)/(2.0*l) + pos[i][1]
            else:
                px[s] = pos[i][0]
                py[s] = pos[i][1]
        count = 2
        for k in xrange(n):
            if k==i or k==j:
                continue
            for s in xrange(2):
                dd = (pos[k][0] - px[s])**2 + (pos[k][1] - py[s])**2
                if dd < 1.001000:
                    count += 1
                    break
        ans = max(ans, count)
print ans