#include<cstdio>
#include<algorithm>
#include<vector>
#include<string>
#include<iostream>
#include<queue>
#include<map>
#include<set>
#include<complex>
#include<stack>
#include<cmath>
  
using namespace std;
  
#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)

#define pb push_back

#define X real()
#define Y imag()
typedef complex<double> P;

class C:public P{
    public:
    double r;
    C(double x,double y,double r):P(x,y),r(r){}
    C(P p, double r):P(p),r(r){}
};


class L:public vector<P>{
	public:
	L(P a, P b){
		pb(a);pb(b);
	}
};


template<class T> T sq(T x){return x*x;}
double dot(P a, P b){return a.X*b.X + a.Y*b.Y;} 
double cross(P a,P b){return a.X*b.Y-a.Y*b.X;}
bool ccw(P a,P b,P c){return cross(b-a,c-a)>=0;}


P projection_LP(L a, P p){
	P e = (a[1]-a[0])/abs(a[1]-a[0]);
	double d = dot(p-a[0], e);
	return a[0]+d*e;
}

P refrection_LP(L a, P p){
	P b = projection_LP(a,p);
	P c = b-p;
	return p+c+c;
}

vector<P> crossP_CC(C a, C b){
	P d = b-a;
	P e = d/abs(d);
	
	double EPS = 0.0000001;
	if(abs(d)+EPS> a.r+b.r )return vector<P>();
	
	double x = abs(d)*a.r/(a.r+b.r);
	double y = sqrt(sq(a.r)-sq(x));
	
	
	P sp = a + x*e;
	vector<P> ret;
	ret.pb(sp + y*(e*P(0,1)));
	ret.pb(refrection_LP(L(a,b), ret[0]));
	return ret;
}

int main(){
	while(1){
		int n;
		cin>>n;
		if(n==0)break;
		
		vector<C> circle;
		
		rep(i,n){
			double a,b;
			scanf("%lf,%lf",&a,&b);
			circle.pb(C(P(a,b),1));
		}
		
		
		vector<P> cand;
		rep(i,n){
			reps(j,i+1,n){
				vector<P> res = crossP_CC(circle[i],circle[j]);
				rep(k,res.size()){
					cand.pb(res[k]);
				}
			}
		}
		rep(i,circle.size())cand.pb(circle[i]);
		
		int ans = 0;
		rep(i,cand.size()){
			int cnt = 0;
			rep(j,circle.size()){
				P d = cand[i]-circle[j];
				double EPS = 0.000000001;
				if(abs(d)-EPS<1)cnt++;
			}
			ans = max(ans,cnt);
		}
		
		printf("%d\n",ans);
	}
}