#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>

int n;
struct point{
	double x,y;
	point(){}
	point(double xx,double yy){
		x=xx;
		y=yy;
	}

	point operator + (point p){
		return point(x+p.x,y+p.y);
	}
	point operator / (double d){
		return point(x/d,y/d);
	}
};

point p[101];

int main(void){
	while(1){
		scanf("%d",&n);
		if(n==0)break;
		for(int i=0;i<n;i++){
			scanf("%lf,%lf",&p[i].x,&p[i].y);
		}
		if(n==1)printf("1\n");
		else{
			int res=1;
			for(int i=0;i<n;i++){
				for(int j=i+1;j<n;j++){
					point mid=(p[i]+p[j])/2.0;
					double ang=atan2(mid.y-p[i].y,mid.x-p[i].x);
					double len=(p[i].x-mid.x)*(p[i].x-mid.x)+(p[i].y-mid.y)*(p[i].y-mid.y);
					double np=sqrt(1-len);
					point pp=mid+point(np*cos(ang+M_PI/2.0),np*sin(ang+M_PI/2.0));
					int cnt=2;
					for(int k=0;k<n;k++){
						if(k==i || k==j)continue;
						if((pp.x-p[k].x)*(pp.x-p[k].x)+(pp.y-p[k].y)*(pp.y-p[k].y)<=1.0)cnt++;
					}
					res=std::max(res,cnt);
					pp=mid+point(np*cos(ang-M_PI/2.0),np*sin(ang-M_PI/2.0));
					cnt=2;
					for(int k=0;k<n;k++){
						if(k==i || k==j)continue;
						if((pp.x-p[k].x)*(pp.x-p[k].x)+(pp.y-p[k].y)*(pp.y-p[k].y)<=1.0)cnt++;
					}
					res=std::max(res,cnt);
				}
			}
			printf("%d\n",res);
		}
	}
	return 0;
}