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