#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++){
		if(A[i]==p||A[i]==p0)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){
		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;
	}
}