#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main(){
  int n;
  while(cin>>n,n){
    double seal[100][2] = {0};
    int max = 1;
    for(int i=0; i<n; i++){scanf("%lf,%lf",&seal[i][0],&seal[i][1]);}
    for(int i=0; i<n; i++){
      for(int j=i+1; j<n; j++){
	double x = seal[i][0]-seal[j][0];
	double y = seal[i][1]-seal[j][1];
	if(x*x+y*y<=4){
	  double edge = sqrt(1-(x*x+y*y)/4);
	  double vecx = y/(x*x+y*y)*edge;
	  double vecy = -x/(x*x+y*y)*edge;
	  double cx = (seal[i][0]+seal[j][0])/2;
	  double cy = (seal[i][1]+seal[j][1])/2;
	  cx+=vecx;
	  cy+=vecy;
	  int a = 0;
	  for(int k=0; k<n; k++){if((cx-seal[k][0])*(cx-seal[k][0])+(cy-seal[k][1])*(cy-seal[k][1])<=1){a++;}}
	  if(a>max){max = a;}
	  cx-=vecx*2;
	  cy-=vecy*2;
	  a = 0;
	  for(int k=0; k<n; k++){if((cx-seal[k][0])*(cx-seal[k][0])+(cy-seal[k][1])*(cy-seal[k][1])<=1){a++;}}
	  if(a>max){max = a;}
	}
      }
    }
    cout <<max<<endl;
  }
  return 0;
}