#include<cstdio>
#include<complex>
#define rep(i,n) for(int i=0;i<n;i++)
#define EPS 1e-8
using namespace std;
typedef complex<double> P;
int main(){
	int n; double x,y;
	while(scanf("%d",&n),n){
		P p[n]; rep(i,n)scanf("%lf,%lf",&x,&y),p[i]=P(x,y);
		int mx=1,m1,m2;
		rep(i,n)rep(j,i)if(norm(p[i]-p[j])<4+EPS){
			P M=(p[i]+p[j])/P(2,0),C1,C2;
			double l=sqrt(1-norm(M-p[i])),a=arg(p[j]-p[i]);
			C1=M+polar(l,a+M_PI/2),C2=M+polar(l,a-M_PI/2);
			m1=m2=0;
			rep(k,n){
				if(norm(p[k]-C1)<1+EPS)m1++; if(norm(p[k]-C2)<1+EPS)m2++;
			}
			if(m1>mx)mx=m1; if(m2>mx)mx=m2;
		}
		printf("%d\n",mx);
	}
	return 0;
}