#include <cstdio>
#include <complex>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main()
{
    typedef complex<double> C;
    double eps = 1e-20;

    while (true)
    {
        int n;
        scanf("%d", &n);
        if (n==0)
            break;

        vector<C> P;
        for (int i=0; i<n; i++)
        {
            double re, im;
            scanf("%lf,%lf", &re, &im);
            P.push_back(C(re,im));
        }

        int ans = 0;

        for (auto p1: P)
        for (auto p2: P)
        if (p1!=p2)
        {
            double d = abs(p1-p2);
            if (d<2)
            {
                C t = C(d/2,sqrt(1-d*d/4))*(p2-p1)/abs(p2-p1)+p1;
                //printf("%f %f\n", t.real(), t.imag());

                int c = 0;
                for (auto p: P)
                    if (abs(p-t)<1+eps)
                        c++;
                ans = max(ans, c);
            }
        }

        printf("%d\n", ans);
    }
}