#include<algorithm>
#include<iostream>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#define dis(p,q) ((p)*(p)+(q)*(q))
using namespace std;
void cc(double px,double py,double pr,double qx,double qy,double qr,double& rx,double& ry,double& sx,double& sy){
  double a=atan2(qy-py,qx-px);
  double b=acos((dis(px-qx,py-qy)+pr*pr-qr*qr)/2/pr/sqrt(dis(px-qx,py-qy)));
  rx=px+cos(a+b)*pr;
  ry=py+sin(a+b)*pr;
  sx=px+cos(a-b)*pr;
  sy=py+sin(a-b)*pr;
  return;
}
int main(){
  int i,j,k;
  int n;
  while(cin>>n&&n){
    double x[100],y[100];
    for(i=0;i<n;i++)
      scanf("%lf,%lf",&x[i],&y[i]);
    int mx=1;
    for(i=0;i<n-1;i++){
      for(j=i+1;j<n;j++){
	if(dis(x[i]-x[j],y[i]-y[j])<=4){
	  double px,py,qx,qy;
	  cc(x[i],y[i],1,x[j],y[j],1,px,py,qx,qy);
	  int ct=2,cu=2;
	  for(k=0;k<n;k++){
	    if(i!=k&&j!=k){
	      if(dis(x[k]-px,y[k]-py)<=1)
		ct++;
	      if(dis(x[k]-qx,y[k]-qy)<=1)
		cu++;
	    }
	  }
	  mx=max(mx,max(ct,cu));
	}
      }
    }
    cout<<mx<<endl;
  }
  return 0;
}