#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define vi vector<int>
#define pb push_back
#define INF 999999999
//#define INF (1LL<<59)
#define EPS (1e-13)

class P{                    //テァツつケ
public:
	double x,y;
	
	P(double _x=0,double _y=0):x(_x),y(_y){};
	P operator + (const P &p     )const{ return P( x+p.x , y+p.y ); }  //テ・ツ環?ァツョツ?
	P operator - (const P &p     )const{ return P( x-p.x , y-p.y ); }  //テヲツクツ崚ァツョツ?
	P operator * (const double k )const{ return P( x*k   , y*k    ); } //テ、ツケツ療ァツョツ?
	P operator / (const double k )const{ return P( x/k   , y/k    ); } //テゥツ卍、テァツョツ?
};

double sqDist(P a, P b)         {return (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y);}


//2テァツつケテ」ツつ津ゥツ?堙」ツつ凝・ツ債甘・ツセツвテ」ツ?ョテ・ツ??」ツ?ョテ、ツクツュテ・ツソツε・ツコツァテヲツィツ凖」ツつ津ヲツアツづ」ツつ?」ツつ?verified AOJ1132
pair<P,P> geoGetCircleOf2pAndR(P p1,P p2,double r){
	P pc1,pc2, p3;
	double d, l, dx, dy ;
	
	p3 = (p1+p2)/2.0;
	l = sqDist(p2,p3);
	
	if  (r*r < l)return pair<P,P>(P(-INF,-INF),P(-INF,-INF));
	
	d  = sqrt(r*r/l - 1.0) ;
	dx = d * (p2-p3).y ;
	dy = d * (p2-p3).x ;
	
	pc1.x = p3.x + dx ;
	pc1.y = p3.y - dy ;
	
	pc2.x = p3.x - dx ;
	pc2.y = p3.y + dy ;
	
	return pair<P,P>(pc1,pc2);
}


int main(){
	int n;
	while(cin>>n&&n){
		vector<P> points(n);
		char ch;
		rep(i,n)cin>>points[i].x>>ch>>points[i].y;
		
		int ans = 1;
		rep(i,n){
			for(int j=i+1;j<n;j++){
				P res[2];
				tie(res[0],res[1]) = geoGetCircleOf2pAndR(points[i], points[j], 1);
				if(res[0].x==-INF)continue;

				rep(k,2){
					int tmp = 0;
					P ri = res[k];
					rep(l,n){
						if( sqDist(ri, points[l])<=1+EPS )tmp++;
					}
					ans = max(tmp,ans);
				}
			}
		}
		cout<<ans<<endl;
	}
}