#include<iostream>
#include<vector>
#include<cmath>

#define EPS 1.0e-12
using namespace std;

struct CPoint{
	CPoint():x(-1),y(-1){}
	CPoint(double x, double y):x(x),y(y){}
	double x,y;
};
struct CSeal{
	CSeal():r(0){}
	CSeal(double x, double y):p(x,y),r(1.0){}
	CPoint p;
	double r;
};
inline double Distance(const CPoint &a, const CPoint &b){
	return sqrt( pow(b.x - a.x, 2.0) + pow(b.y - a.y, 2.0) ); 
}
inline double Distance(const CSeal &a, const CSeal &b){
	return Distance( a.p, b.p );
}
pair<CPoint,CPoint> CrossPoints(const CSeal &a, const CSeal &b)
{
	pair<CPoint, CPoint> ans;
	
	if( Distance(a,b) > 2 ){
		ans.first.x = -1;
		ans.first.y = -1;
		ans.second.x = -1;
		ans.second.y = -1;
		return ans;
	}

	if( a.p.x == b.p.x )
	{
		double D = Distance(a, b);
		double off = sqrt(1-pow((D/2),2));
		ans.first.x = a.p.x - off;
		ans.second.x = a.p.x + off;
		if( a.p.y >= b.p.y )
			ans.first.y = a.p.y - D/2;
		else
			ans.first.y = b.p.y - D/2;
		ans.second.y = ans.first.y;
	}
	else
	{
		double xa = a.p.x;
		double xb = b.p.x;
		double ya = a.p.y;
		double yb = b.p.y;
		double A = (xa+xb)/2 - ( (pow(yb,2)-pow(ya,2)) / (2*(xa-xb)) );
		double m = (yb-ya)/(xa-xb);

		double aVal = 1 + pow(m,2);
		double bVal = m*(A-xb)-yb;
		double cVal = pow(A,2)+pow(xb,2)+pow(yb,2)-2*xb*A-1;

		//cout << "b=" << bVal << "\ta=" << aVal << "\tc=" << cVal << "\tD=" << pow(bVal,2) - aVal * cVal << endl;

		ans.first.y = (-bVal + sqrt( pow(bVal,2) - aVal * cVal )) / aVal;
		ans.second.y = (-bVal - sqrt( pow(bVal,2) - aVal * cVal )) / aVal;
		ans.first.x = A + m*ans.first.y;
		ans.second.x = A + m*ans.second.y;
	}

	if( Distance(a,b) == 2 ){
		ans.second.x = -1;
		ans.second.y = -1;
	}
	return ans;
}
inline bool inPaper( const CPoint &p ){
	return p.x >= 0 && p.y >= 0 && p.x <= 10 && p.y <= 10;
}
int main(void){
	/*CSeal sa(0,0),sb(0,2);
	pair<CPoint,CPoint> tmp = CrossPoints(sa,sb);
	cout << tmp.first.x << " " << tmp.first.y << "," << tmp.second.x << " " << tmp.second.y << endl;*/
	
	while( true ){
		int n;
		unsigned int maxOverlapped = 1;
		vector<CSeal> vSeals;
		vector<CPoint> vCrossPoints;

		cin >> n;
		if( n == 0 ) break;

		for(int i = 0; i < n; ++i){
			double x, y;

			cin >> x;
			cin.ignore(1);
			cin >> y;
			CSeal tmp(x, y);
			vSeals.push_back(tmp);
		}

		for(unsigned int i = 0; i < vSeals.size(); ++i){
			for(unsigned int j = i; j < vSeals.size(); ++j){
				if( i != j ){
					pair<CPoint, CPoint> cp;
					cp = CrossPoints( vSeals[i], vSeals[j] );
					if( inPaper( cp.first ) ){
						vCrossPoints.push_back( cp.first );
					}
					if( inPaper( cp.second ) ){
						vCrossPoints.push_back( cp.second );
					}
				}
			}
		}

		for(unsigned int i = 0; i < vCrossPoints.size(); ++i){
			unsigned int overlapped = 0;
			for(unsigned int j = 0; j < vSeals.size(); ++j){
				if( Distance( vCrossPoints[i], vSeals[j].p ) <= 1 + EPS ){
					++overlapped;
				}
			}
			maxOverlapped = max( maxOverlapped, overlapped );
		}

		cout << maxOverlapped << endl;
	}
	return 0;
}