#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;

double dis(double x1,double y1,double x2,double y2){
  return sqrt( (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2) );
}

int main(){
  int n;
  double x[100],y[100];
  double adjx,adjy;


  while(1){
    cin >> n;
    if(!n)break;

    for(int i=0;i<n;i++)scanf("%lf,%lf",&x[i],&y[i]);

    int m = 0;
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++){
	if(dis(x[i],y[i],x[j],y[j]) <= 2.0 + 1e-10){
	  if(i==j){
	    adjx = x[i];
	    adjy = y[i];
	  }else{
	    double mx = (x[i]+x[j])/2.0,my = (y[i]+y[j])/2.0;
	    double d = dis(x[i],y[i],mx,my);
	    double len = sqrt(1 - d*d);
	    double nx = -1.0 * (my-y[i]),ny = mx-x[i];
	    double dn = dis(0.0,0.0,nx,ny);
	    adjx = (nx * len)/dn + mx;
	    adjy = (ny * len)/dn + my;
	  }
	  int c = 0;
	  for(int k=0;k<n;k++){
	    if(dis(adjx,adjy,x[k],y[k]) <= 1.0 +  1e-10)c++;
	  }
	  m = max(m,c);
	}
      }
    }

    cout << m << endl;
  }
}
	