#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

typedef struct
{
    double x;
    double y;
}T_Point;

bool isContained(T_Point p1, T_Point p2);
const double DIST_LIMIT = 1.0;

int main()
{
    int n;
    vector<T_Point> points;
    while(cin >> n && n)
    {
        points.clear();
        for(int i=0; i<n; i++)
        {
            T_Point pt;
            char ch;
            cin >> pt.x >> ch >> pt.y;
            points.push_back(pt);
        }
        int ans = 0;
        for(double x=0; x<10.1; x+=0.01)
        {
            for(double y=0; y<10.1; y+=0.01)
            {
                T_Point tmp_pt;
                tmp_pt.x = x;
                tmp_pt.y = y;
                int count = 0;
                for(int i=0; i<n; i++)
                {
                    if(isContained(tmp_pt, points[i]))
                    {
                        count++;
                    }
                }
                ans = std::max(ans, count);
            }
        }
        cout << ans << endl;
    }
    return 0;
}

bool isContained(T_Point p1, T_Point p2)
{
    bool result = false;
    double dist = hypot(p2.x - p1.x, p2.y - p1.y);
    if(islessequal(dist, DIST_LIMIT))
    {
        result = true;
    }
    else
    {
        result = false;
    }
    return result;
}

