#include<iostream>
#define pb push_back
#include<cmath>
#include<vector>
#include<complex>
#define eps 1e-6
using namespace std;
typedef complex<double> P;
bool same(P a,P b){
	if((a.imag()-b.imag())*(a.imag()-b.imag())+(a.real()-b.real())*(a.real()-b.real())<4.0+eps)
		return true;
	return false;
}
double dist(P a,P b){
	return sqrt((a.imag()-b.imag())*(a.imag()-b.imag())+(a.real()-b.real())*(a.real()-b.real()));
}
int n;
vector<P> p;
bool q(P a,P b){
	if((a.imag()-b.imag())*(a.imag()-b.imag())+(a.real()-b.real())*(a.real()-b.real())<1.0+eps)
		return true;
	return false;
}
int cal(P a,P b){
	int ret=0,rett=0;
	double plus=1-dist(a,(a+b)*0.5);
	
	P s=P(0,1)*(b-a)/abs(b-a)*plus+(a+b)*0.5;
	P t=P(0,-1)*(b-a)/abs(b-a)*plus+(a+b)*0.5;
	//cout<<t.imag()<<endl;
	for(int i=0;i<n;i++){
		if(q(s,p[i]))
		ret++;
		if(q(t,p[i]))
		rett++;
	}
	return max(ret,rett);
}
int main(){
	while(cin>>n,n){
		p.clear();
		char c;
		for(int i=0;i<n;i++){
			double x,y;
			cin>>x>>c>>y;
			p.pb(P(x,y));
		}
		int ans=1;
		for(int i=0;i<n;i++){
			for(int j=i+1;j<n;j++){
				if(same(p[i],p[j])){
					ans=max(cal(p[i],p[j]),ans);
				}
			}
		}
		cout<<ans<<endl;
	}
	return 0;
}