#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
using namespace std;

#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()
const int INF = 1<<29;
const double EPS = 1e-8;

typedef complex<double> P;

pair<P, P> circle_circle_intersect(const P& c1, const double& r1, const P& c2, const double& r2) {
  P A = conj(c2-c1), B = (r2*r2-r1*r1-(c2-c1)*conj(c2-c1)), C = r1*r1*(c2-c1);
  P D = B*B-4.0*A*C;
  P z1 = (-B+sqrt(D))/(2.0*A)+c1, z2 = (-B-sqrt(D))/(2.0*A)+c1;
  return pair<P,P>(z1, z2);
}
int main() {
  int n;
  while(scanf("%d",&n), n) {
    P points[n];
    REP(i,n) {
      double x,y;
      scanf("%lf,%lf", &x, &y);
      points[i] = P(x,y);
    }
    vector<P> v;
    REP(i, n-1) {
      for(int j=i+1; j<n; ++j) {
        P p = points[i];
        P q = points[j];

        if (norm(p-q) <= 2 + EPS) {
          pair<P,P> ppp = circle_circle_intersect(p,1,q,1);
          v.push_back(ppp.first);
          v.push_back(ppp.second);
        }
      }
    }
    int res = 0;
    FOR(it, v) {
      int tmp = 0;
      REP(i,n)
        if (norm((*it) - points[i]) <= 1 + EPS) ++tmp;
      res = max(res, tmp);
    }
    cout << res << endl;
  }
}