#include<stdio.h>
#include<algorithm>
#include<math.h>
int n;
double x[100],y[100];

double Square(double a){return a*a;}
double Distance2(double x1, double y1, double x2, double y2)
{
	return Square(x2-x1)+Square(y2-y1);
}

int CountOverlap(double px, double py)
{
	int res = 0;
	for(int i=0; i<n; ++i)
	{
		if(Distance2(x[i],y[i],px,py)<=1+1e-9)
			++res;
	}
	return res;
}

int main()
{
	const double pi = 4*atan(1.);
	while(scanf("%d",&n),n)
	{
		int i,j,k;
		int res = 0;
		for(i=0; i<n; ++i)
			scanf("%lf,%lf",x+i,y+i);

		for(i=0; i<n; ++i)
		{
			for(j=0; j<10000; ++j)
				res = std::max(res,CountOverlap(x[i]+cos(2*pi/j),y[i]+sin(2*pi/j)));
		}
		printf("%d\n",res);
	}
	return 0;
}