#include<bits/stdc++.h>

#define EQ(a,b) (abs((a)-(b)) < EPS)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define sz size()
#define all(a) (a).begin(),(a).end()

using namespace std;
typedef double D;
typedef complex<D> P;
typedef pair<P,P> L;
typedef vector<P> Poly;
typedef pair<P,D> C;

const D EPS = 1e-8;
const D PI = acos(-1);

//for vector
inline P unit(P p){return p/abs(p);}

inline D dot(P x, P y){return real(conj(x)*y);}

inline D cross(P x, P y){return imag(conj(x)*y);}

//rotate a point counter-clockwise on the origin
inline P rotate(P v, D s){
  return P(real(v)*cos(s) - imag(v)*sin(s), real(v)*sin(s) + imag(v)*cos(s) );
}

//return seta A
inline D arg(D a,D b,D c){return acos( (b*b+c*c-a*a)/(2*b*c) );}

//circle position relation
inline int cpr(C a,C b){
  D d = abs(a.fs-b.fs);
  if(a.sc+b.sc + EPS < d)return -1;      //no cross point (outside)
  if(b.sc+d + EPS < a.sc)return 1;       //no cross point (inside,B in A)
  if(a.sc+d + EPS < b.sc)return 2;       //no cross point (inside,A in B)
  if(abs(a.sc+b.sc - d) < EPS)return -3; //one cross point (outside)
  if(abs(b.sc+d - a.sc) < EPS)return 3;  //one cross point (inside,B in A)
  if(abs(a.sc+d - b.sc) < EPS)return 4;  //one cross point (inside,A in B)
  return 0;                              //two cross point
}

inline vector<P> cp_cir_to_cir(C a, C b){
  vector<P> v;
  int pos = cpr(a,b);
  if(pos==0){
    D s = arg(b.sc,abs(b.fs-a.fs),a.sc);
    P x = a.sc * unit(b.fs - a.fs);
    v.pb(a.fs + rotate(x,s));
    v.pb(a.fs + rotate(x,-s));
  }else if(abs(pos) >= 3){
    v.pb(a.fs + a.sc * unit(b.fs-a.fs));
  }
  return v;
}

int main(){
  int n;
  while(scanf("%d",&n), n){
    vector<C> c(n);
    D a,b;
    for(int i=0;i<n;i++){
      scanf("%lf,%lf",&a,&b);
      c[i] = C(P(a,b),1);
    }

    int res = 1;
    for(int i=0;i<n;i++){
      for(int j=0;j<i;j++){
	vector<P> cp = cp_cir_to_cir(c[i],c[j]);

	for(P p : cp){
	  int cnt = 0;
	  for(int k=0;k<n;k++){
	    if(abs(c[k].fs-p)<1.0+EPS)cnt++;
	  }
	  res = max(res,cnt);
	}
      }
    }

    cout << res << endl;
  }
}