from itertools import combinations


def memorize(f):
    memo = {}

    def helper(p1, p2):
        key = (p1, p2)
        if key in memo:
            return memo[key]
        res = f(p1, p2)
        memo[key] = res
        memo[(p2, p1)] = res
        return res

    return helper


@memorize
def dist_square_id(p1, p2):
    (x1, y1) = seals[p1]
    (x2, y2) = seals[p2]
    return dist_square(x1, y1, x2, y2)


def dist_square(x1, y1, x2, y2):
    return (x2 - x1) ** 2 + (y2 - y1) ** 2


n = int(input())
seals = [tuple(map(float, input().split(','))) for _ in range(n)]
eps = 1e-6

max_count = 0

for p1, p2 in combinations(range(n), 2):
    l = dist_square_id(p1, p2)
    if l + eps > 4:
        continue
    l **= 0.5
    x1, y1 = seals[p1]
    x2, y2 = seals[p2]
    mx, my = (x1 + x2) / 2, (y1 + y2) / 2
    dx, dy = x2 - x1, y2 - y1
    hl = (1 - l ** 2 / 4) ** 0.5
    nx, ny = -dy * hl / l, dx * hl / l
    cx1, cy1 = mx + nx, my + ny
    cx2, cy2 = mx - nx, my - ny

    count1 = count2 = 2
    for i in range(n):
        if i == p1 or i == p2:
            continue
        tx, ty = seals[i]
        count1 += dist_square(tx, ty, cx1, cy1) < 1 + eps
        count2 += dist_square(tx, ty, cx2, cy2) < 1 + eps

    max_count = max(max_count, count1, count2)

print(max_count)