#include <complex>
#include <iostream>
#include <vector>
using namespace std;
vector<complex<double> >A;
complex<double>j=sqrt(-1),p1,p2,p3,p4,v;
double a,b;
int n;
int f(int m){
	int i,s1=2,s2=2;
	double c=acos(a/2);
	p3=polar(1.0,b+c)+p1;
	p4=polar(1.0,b-c)+p1;
	for(i=0;i<n;i++){
		if(A[i]==p1||A[i]== p2)continue;
		if(abs(A[i]-p3)-1<1e-6)s1++;
		if(abs(A[i]-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){
		A.clear();A.resize(n);
		for(i=0;i<n;i++){
			cin>>a>>c>>b;
			A[i]=complex<double>(a,b);
		}
		m=1;
		for(i=0;i<n;i++){
			p1=A[i];
			for(i1=i+1;i1<n;i1++){
				p2=A[i1];
				v=p2-p1;
				a=abs(v);b=arg(v);
				if(a<=2)m=f(m);
			}
		}
		cout<<m<<endl;
	}
}