#include <complex>
#include <iostream>
#include <vector>
using namespace std;
typedef complex<double> P;
P A[100],j=sqrt(-1),p,p0;
double a,b,d;
int n;
int f(int m){
	int i,s1=2,s2=2;
	d=acos(a/2);
	P p3=polar(1.0,b+d)+p,p4=polar(1.0,b-d)+p;
	for(i=0;i<n;i++){
		P q=A[i];
		if(q==p||q==p0)continue;
		if(abs(q-p3)-1<1e-6)s1++;
		if(abs(q-p4)-1<1e-6)s2++;
	}
	if(m<s1)m=s1;
	if(m<s2)m=s2;
	return m;
}
int main(){
	int m,i,i1;
	char c;
	while(cin>>n,n!=0){
		for(i=0;i<n;i++){
			cin>>a>>c>>b;A[i]=P(a,b);
		}
		m=1;
		for(i=0;i<n;i++){
			p=A[i];
			for(i1=i+1;i1<n;i1++){
				p0=A[i1];a=abs(p0-p);b=arg(p0-p);
				if(a<=2)m=f(m);
			}
		}
		cout<<m<<endl;
	}
}