#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>
#include<complex>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()
#define DBL(x) ((x)*(x))
#define EPS 1e-10

using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef complex<double> P;

int main(){
  int n;
  const P r(0.0,1.0);
  while(scanf("%d",&n) , n){
    vector<P> o(n);
    int ans = 1;
    REP(i, n) scanf("%lf,%lf",&o[i].real(), &o[i].imag());
    for(int i=0; i<n; i++){
      for(int j=i+1; j<n; j++){
	if(abs(o[i] - o[j]) > 2.0) continue;
	if(abs(o[i] - o[j]) < EPS){
	  ans = max(ans, 2);
	  continue;
	}
	P mid = (o[i] + o[j]) / 2.0;
	P dir = (o[i] - o[j]) / 2.0;
	double len = sqrt(1.0 - DBL(abs(dir)));
	if(len < EPS){
	}else{
	  dir *= r;
	  dir /= abs(dir);
	  dir *= len;
	}

	P pos[2] = { mid + dir, mid - dir };

	REP(idx,2){
	  int cnt = 0;
	  //printf("(%d,%d),(%f,%f): ",i+1,j+1,abs(pos[idx] - o[i]),abs(pos[idx] - o[j]));
	  REP(k, n){
	    double dist = abs(pos[idx] - o[k]);
	    if(dist <= 1.0 + EPS){
	      //printf("%d(%f) ",k+1,dist);
	      cnt++;
	    }
	  }
	  //puts("");
	  ans = max(ans, cnt);
	}
      }
    }
    printf("%d\n",ans);
  }
  return 0;
}