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

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

bool isCrossed(T_Point p1, T_Point p2);
bool checkGroup(vector<T_Point>& points, vector<int>& group, T_Point pt);
//void debugVector(vector<int>& vec);
const double DIST_LIMIT = 2.0;

int main()
{
    int n;
    vector<T_Point> points;
    vector< vector<int> > overlaps;
    vector<bool> is_grouped;
    while(cin >> n && n)
    {
        points.clear();
        overlaps.clear();
        is_grouped.clear();

        for(int i=0; i<n; i++)
        {
            T_Point pt;
            char ch;
            cin >> pt.x >> ch >> pt.y;
            points.push_back(pt);
            is_grouped.push_back(false);
        }
        for(int i=0; i<n; i++)
        {
            if(is_grouped[i])
            {
                continue;
            }
            vector<int> vec;
            vec.push_back(i);
            for(int j=i+1; j<n; j++)
            {   
                if(checkGroup(points, vec, points[j]))
                {
                    vec.push_back(j);
                    is_grouped[j] = true;
                    //debugVector(vec);
                }
            }
            overlaps.push_back(vec);
        }
        unsigned long ans = 0;
        for(int i=0; i<overlaps.size(); i++)
        {
            ans = std::max(ans, overlaps[i].size());
        }
        cout << ans << endl;
    }
    return 0;
}

bool isCrossed(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;
}

bool checkGroup(vector<T_Point>& points, vector<int>& group, T_Point pt)
{
    bool result = false;

    for(int i=0; i<group.size(); i++)
    {
        if(isCrossed(pt, points[group[i]]))
        {
            result = true;
            break;
        }
    }
    return result;
}
/*
void debugVector(vector<int>& vec)
{
    for(int i=0; i<vec.size(); i++)
    {
        cout << "debug: " << vec[i] << " ";
    }
    cout << endl;
}
*/

