#include <stdio.h>
#include <math.h>
struct pnt{double x,y;pnt() {};pnt(double a, double b) {x=a,y=b;}};double h;
struct line{double A,B,C;line() {};line(pnt a, pnt b) {A=a.y-b.y,B=b.x-a.x,C=-A*a.x-B*a.y;}};
pnt kramer(pnt x1, pnt x2, double t) {
    line a=line(x1,x2);
	double g=(x2.x*x2.x-x1.x*x1.x+x2.y*x2.y-x1.y*x1.y),delta;
    delta=t*2.0*(a.A*a.A+a.B*a.B);
    return pnt((2.0*a.A*(h-t*a.C)+t*a.B*g)/delta,(2.0*a.B*(h-t*a.C)-t*a.A*g)/delta);
}
int dist(pnt a, pnt b, double val) {
    return (((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y))<=val+1e-6);
}
int main() {
    int N,i,j,k,cnt,f;double a,b;pnt RB[105];
	while (scanf("%d",&N)!=EOF && N) {
        for (i=0;i<N;i++) scanf("%lf,%lf",&a,&b),RB[i]=pnt(a,b);cnt=1;
        for (i=0;i<N;i++) for (j=i+1;j<N;j++) if (dist(RB[i],RB[j],4.0)) {
            line q=line(RB[i],RB[j]);h=q.A*q.A+q.B*q.B,h=cos(0.5*acos((2.0-h)/2.0))*sqrt(h);
            RB[104]=kramer(RB[i],RB[j],1.0);
            for (k=f=0;k<N;k++)
				f+=dist(RB[104],RB[k],1.0);
			if (cnt<f) cnt=f;
			RB[104]=kramer(RB[i],RB[j],-1.0);
            for (k=f=0;k<N;k++)
				f+=dist(RB[104],RB[k],1.0);
			if (cnt<f) cnt=f;
        }
        printf("%d\n",cnt);
    }
    return 0;
}