#include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>

using namespace std;

typedef pair<double,double> P;
double EPS = 1e-10;

double add(double a, double b){
  if(abs(a+b) < EPS * (abs(a)+abs(b)))return 0;
  return a+b;
}

struct point{
  double x, y;
  point(){}
  point(double x,double y) : x(x) , y(y){}

  point operator + (point p){
    return point(add(x,p.x), add(y,p.y));
  }

  point operator - (point p){
    return point(add(x,-p.x), add(y,-p.y));
  }

  point operator * (double d){
    return point(x*d,y*d);
  }

  point operator / (double d){
    return point(x/d,y/d);
  }
};


struct circle{
  point p;
  double r;
};

vector<point> circles_cross(circle a, circle b){
    vector<point> ret;
     
    double x = a.p.x - b.p.x , y = a.p.y - b.p.y;
    double L = x * x + y * y;
    if(L > pow(a.r+b.r,2))return ret;
     
    L = sqrt(L);
    double C = atan2(b.p.y-a.p.y,b.p.x-a.p.x);
    double alpha = acos((L*L+a.r*a.r-b.r*b.r)/(2*L*a.r));
     
    point r1,r2;
    r1.x = a.p.x + cos(C+alpha) , r1.y = a.p.y + sin(C+alpha);
    r2.x = a.p.x + cos(C-alpha) , r2.y = a.p.y + sin(C-alpha);
     
    ret.push_back(r1) , ret.push_back(r2);
     
    return ret;
}

int main(void){
  int n;
  circle a[100];

  while(cin >> n,n){
    vector<P>d;

    for(int i=0;i<n;i++){
      scanf("%lf,%lf",&a[i].p.x,&a[i].p.y);
      a[i].r=1;
    }
    /*
      for(int i=0;i<n;i++){
      for(int j=i+1;j<n;j++){
      double L=sqrt(pow(x[i]-x[j],2)+pow(y[i]-y[j],2));
      if(L>2.0000)continue;
      double theta=atan2(y[j]-y[i],x[j]-x[i]);
      double a=acos(L/2);
      d.push_back(make_pair(x[i]+cos(theta+a),y[i]+sin(theta+a)));
      d.push_back(make_pair(x[i]+cos(theta-a),y[i]+sin(theta-a)));
      }
      }
    */
    for(int i=0;i<n;i++){
      for(int j=i+1;j<n;j++){
	vector<point> p=circles_cross(a[i],a[j]);
	for(int k=0;k<p.size();k++){
	  d.push_back(make_pair(p[k].x,p[k].y));
	}
      }
    }
    /*
    for(int i=0;i<d.size();i++){
      cout << d[i].first << " " <<d[i].second << endl;
    }
    */
    int count,ans=1;
    for(int i=0;i<d.size();i++){
      count=0;
      
      for(int j=0;j<n;j++){
	if(pow(d[i].first-a[j].p.x,2)+pow(d[i].second-a[j].p.y,2)<=1.0+EPS)count++;
      }
	ans=max(ans,count);
    }
    cout << ans << endl;
  }
  return 0;
}