#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
typedef double Real;
typedef complex<Real> P;

bool ishit_circle_segment(P o, Real r, P t, P s){
    // s to origin
    o -= s;
    t -= s;
    // t on x axis
    if(s==t)return false;
    o = (o / t) * abs(t);
    
    Real d = r*r - o.imag()*o.imag();
    if(d < 0.0)return false;
    Real x0 = o.real() + sqrt(d);
    Real x1 = o.real() - sqrt(d);
    Real tb = abs(t);
    if(0.0 <= x0 && x0 <= tb)return true;
    if(0.0 <= x1 && x1 <= tb)return true;
    return false;
}
pair<P,P> hitpoint_circle_circle(P o1,Real r1,P o2,Real r2){
    if(o1==o2 && r1==r2){
        return make_pair(o1,o2);
    }
    // o1 to origin
    o2 -= o1;
    Real x1 = o2.real();
    Real y1 = o2.imag();
    Real a = (x1*x1 + y1*y1 + r1*r1 - r2*r2)/2.0;
    Real d = (x1*x1 + y1*y1)*r1*r1 - a*a;
    if(d < 0.0){
        return make_pair(o1,o2+o1);
    }
    if(x1*x1 + y1*y1 == 0.0){
        return make_pair(o1,o2+o1);
    }
    P hit1 = P((a*x1+y1*sqrt(d))/(x1*x1+y1*y1), (a*y1-x1*sqrt(d))/(x1*x1+y1*y1));
    P hit2 = P((a*x1-y1*sqrt(d))/(x1*x1+y1*y1), (a*y1+x1*sqrt(d))/(x1*x1+y1*y1));
    return make_pair(hit1+o1,hit2+o1);
}
bool inner_circle_point(P o,Real r,P p){
    return abs(p-o)<=r+1e-8;
}

int n;
P ps[125];

int main(void){
    // Here your code !
    while(true){
        scanf("%d",&n);
        if(n==0)break;
        REP(i,n){
            Real x,y;
            scanf("%lf,%lf",&x,&y);
            ps[i] = P(x,y);
        }
        vector<P> check;
        REP(i,n)REP(j,i){
            pair<P,P> t = hitpoint_circle_circle(ps[i],1.0,ps[j],1.0);
            check.push_back(t.first);
            check.push_back(t.second);
        }
        int ans = 1;
        REP(i,check.size()){
            P p = check[i];
            int tmp = 0;
            REP(j,n){
                if(inner_circle_point(ps[j],1.0,p)){
                    tmp++;
                }
            }
            if(tmp > ans){
               // printf("%f %f -> %d\n",p.real(),p.imag(),tmp);
               ans = tmp;
            }
        }
        printf("%d\n",ans);
    }
}