#include <cstdio>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;

#define EPS 1e-7
typedef pair<double,double> point, circle;

void intrsc( const circle &c1, const circle &c2, vector<point> &v ){
	double a,b,c,d,e,f,g,D;
	double x1,x2,y1,y2,ix1,ix2,iy1,iy2;

	x1 = c1.first;
	x2 = c2.first;
	y1 = c1.second;
	y2 = c2.second;

	a = x1*x1 - x2*x2 + y1*y1 - y2*y2;
	b = 2.0 * ( y1 - y2 );
	c = 2.0 * ( x1 - x2 );
	
	d = b*b + c*c;
	e = b*c*y1 - a*c - b*b*x1;
	f = b*b*(x1*x1 + y1*y1 - 1.0) + a*a - 2*a*b*y1;

	D = e*e - d*f;
	if( D >= 0 ){
		if( abs(d) < EPS ){
			v.push_back( point( x1 + 1.0, y1 ) );
			return;
		}
		g = sqrt(D);
		ix1 = ( -e + g ) / d;
		ix2 = ( -e - g ) / d;
		if( abs(b) < EPS ){
			iy1 = sqrt( 1.0 - (ix1-x1)*(ix1-x1) );
			iy2 = y1 - iy1;
			iy1 += y1;
		}
		else{
			iy1 = ( a - c * ix1 ) / b;
			iy2 = ( a - c * ix2 ) / b;
		}
		v.push_back( point( ix1, iy1 ) );
		v.push_back( point( ix2, iy2 ) );
	}
}

inline bool in( const point &p, const circle &c ){
	return	(p.first-c.first)*(p.first-c.first) +
			(p.second-c.second)*(p.second-c.second) <= 1.0 + EPS;
}

int main(){
	int n;
	double x,y;
	for(; scanf("%d",&n),n; ){
		vector<point> v;
		vector<circle> crcl(n);
		for(int i = 0; i < n; i++ ){
			scanf("%lf,%lf",&x,&y);
			crcl[i] = circle(x,y);
		}

		for(int i = 0; i < n - 1; i++ )
			for(int j = i + 1; j < n; j++ )
				intrsc( crcl[i], crcl[j], v );

		int m = 1;
		for( vector<point>::iterator p_it = v.begin();
				p_it != v.end(); ++p_it ){
			int cnt = 0;
			for( vector<circle>::iterator it = crcl.begin();
					it != crcl.end(); ++it ){
				if( in( *p_it, *it ) )	cnt++;
			}
			m = max( m, cnt );
		}
		printf("%d\n",m);
	}
}