//22
#include<iostream>
#include<complex>
#include<cmath>

using namespace std;

typedef complex<double> P;

int main(){
  for(int n;cin>>n,n;){
    P p[100];
    for(int i=0;i<n;i++){
      double x,y;
      (cin>>x).ignore()>>y;
      p[i]=P(x,y);
    }
    int ans=1;
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++){
	if(abs(p[i]-p[j])>2)continue;
	P c;
	if(p[i]==p[j]){
	  c=p[i];
	}else{
	  c=p[i]+polar(1.,arg(p[j]-p[i])+acos(abs(p[j]-p[i])/2));
	}
	int ci=0;
	for(int k=0;k<n;k++){
	  ci+=abs(p[k]-c)<1+1e-9;
	}
	if(ci>ans){
	  ans=ci;
	}
      }
    }
    cout<<ans<<endl;
  }
  return 0;
}