#include <iostream>
#include <cassert>
#include <cmath>
#include <vector>
#include <complex>
#include <algorithm>
using namespace std;


typedef complex<double> P;
typedef vector<P> G;

#define EPS			(1e-10)
#define PI			(3.14159265358979323846)


#define X(a)		( (a).real() )
#define Y(a)		( (a).imag() )
#define EQ(a,b)		( -EPS<(a)-(b) && (a)-(b)<EPS )
#define EQV(a,b)	( EQ(X(a),X(b)) && EQ(Y(a),Y(b)) )

#define unit(a)		( (a)/abs(a) )
#define normal(a)	( (a)*P(0,1) )
#define dot(a,b)	( X((a)*conj(b)) )
#define cross(a,b)	( Y(conj(a)*(b)) )

bool intersectCC(P a, double ra, P b, double rb)
{
	double v=abs(a-b);
	return ( !(v>ra+rb || v<abs(ra-rb)) );
}

pair<P,P> crosspointCC(P c, double r, P d, double s)
{
	P v = d-c;  double dv=abs(v);
	assert( !(dv>r+s || dv<abs(r-s)) );
 
	double l = ((r*r-s*s)/dv+dv)/2.0;

	P e = c + l*v/dv;
	P p = normal(sqrt(r*r-l*l) * v/dv);

	return make_pair(e+p,e-p);
}


int main()
{
	int n; char c; P p;
	while(cin >> n, n)
	{
		G g;
		for(int i=0; i<n; i++)
		{
			cin >> X(p) >> c >> Y(p);
			g.push_back(p);
		}

		int c1,c2,mx=1;
		for(int i=0; i<n-1; i++)
		for(int j=i+1; j<n; j++)
		{
			if(intersectCC(g[i],1,g[j],1))
			{
				c1=c2=0;
				pair<P,P> s = crosspointCC(g[i],1,g[j],1);
				for(int k=0; k<n; k++)
				{
					if(abs(g[k] - s.first ) <= 1.0+EPS) c1++;
					if(abs(g[k] - s.second) <= 1.0+EPS) c2++;
				}
				mx = max(mx,max(c1,c2));
			}
		}

		cout << mx << endl;
	}
}