#include <bits/stdc++.h>
  
using namespace std;
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)
  
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()
  
#define MOD (ll)(1e9+7)
#define ADD(a,b) a=((a)+(b))%MOD
#define FIX(a) ((a)%MOD+MOD)%MOD

#define INF 1000000000

typedef long double Real;
#define EPS 1e-13
#define EQ(x) (-EPS<x && x<EPS)
typedef complex<Real> P;
Real dot(P a,P b){return real(conj(a)*b);}
Real cross(P a,P b){return imag(conj(a)*b);}

int main(){
  while(true){
    int n;
    cin>>n;
    if(!n)break;
    P ps[n];
    REP(i,n){
      double x,y;
      scanf("%lf,%lf",&x,&y);
      ps[i] = P(x,y);
    }
    int res = 1;
    REP(i,n)REP(j,i){
      P a=ps[i], b=ps[j];
      Real len = abs(b-a);
      if(len>2.0+EPS)continue;
      Real ang_ab = atan2(b.imag()-a.imag(),b.real()-a.real());
      Real ang_x = acos(len/2.0);
      P x = a + exp(P(0,ang_ab+ang_x));
      P y = a + exp(P(0,ang_ab-ang_x));
      if(x.real()<0.0-EPS || x.real()>10.0+EPS || x.imag()<0.0-EPS || x.imag()>10.0+EPS) x=y;
      swap(x,y);
      if(x.real()<0.0-EPS || x.real()>10.0+EPS || x.imag()<0.0-EPS || x.imag()>10.0+EPS) x=y;
      int t = 0;
      REP(k,n){
        if(abs(ps[k]-x)<1.0+EPS || abs(ps[k]-y)<1.0+EPS)++t;
      }
      res = max(res,t);
    }
    cout<<res<<endl;
  }
  return 0;
}