#!/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.0, 2.0

data = []
num_data = int(stdin.readline())
max_overlap = 0

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

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

        distance = math.hypot(x2-x1, y2-y1)
        if distance <= RADIUS_2:
            if x1 != x2 or y1 != y2:
                th = math.atan2(y2-y1, x2-x1)
                al = math.acos(distance**2 / (2.0*distance))
                cp1 = (x1 + math.cos(th + al), y1 + math.sin(th + al))
                cp2 = (x1 + math.cos(th - al), y1 + math.sin(th - al))
            else:
                cp1 = cp2 = (x1, y1)

            count1 = count2 = 0
            for k in range(num_data):
                x3, y3 = data[k]
                if math.hypot(cp1[0]-x3, cp1[1]-y3) <= RADIUS:
                    count1 += 1
                if math.hypot(cp2[0]-x3, cp2[1]-y3) <= RADIUS:
                    count2 += 1

            if max_overlap < count1:
                max_overlap = count2
            if max_overlap < count2:
                max_overlap = count2
print(max_overlap)