#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Reference
http://homepage1.nifty.com/gfk/circle-circle.htm
"""
from __future__ import (division, absolute_import, print_function,
                        unicode_literals)
from sys import stdin
import math

RADIUS, RADIUS_2 = 1 + 1.0e-12, 2 + 1.0e-12

num_data = int(stdin.readline())
data = []
for _ in range(num_data):
    data.append(tuple(float(s) for s in stdin.readline().split(',')))

cross_points = []
for i in range(num_data):
    x1, y1 = data[i]
    for j in range(num_data):
        if i == j:
            continue
        x2, y2 = data[j]

        diff = (x2-x1, y2-y1)
        distance = math.hypot(*diff)
        if distance > RADIUS_2:
            cp1 = cp2 = (-1.0, -1.0)
        elif x1 == x2 and y1 == y2:
            cp1 = cp2 = (x1, y1)
        else:
            k = distance / 2.0
            d = math.sqrt(1 - k**2)
            ndiff = (1.0 / distance * diff[0], 1.0 / distance * diff[1])

            kdiff = (k * ndiff[0] + x1, k * ndiff[1] + y1)
            odiff = (d * ndiff[1], d * -ndiff[0])

            cp1 = (kdiff[0] + odiff[0], kdiff[1] + odiff[1])
            cp2 = (kdiff[0] - odiff[0], kdiff[1] - odiff[1])

        if 0.0 <= cp1[0] <= 10.0 and 0.0 <= cp1[1] <= 10.0:
            cross_points.append(cp1)
        if 0.0 <= cp2[0] <= 10.0 and 0.0 <= cp2[1] <= 10.0:
            cross_points.append(cp2)


max_overlap = 0
for cx, cy in cross_points:
    count = 0
    for x, y in data:
        if math.hypot(cx-x, cy-y) <= RADIUS:
            count += 1
    if max_overlap < count:
        max_overlap = count
print(max_overlap)