#include <cstdio>
#include <vector>
#include <complex>
using namespace std;

#define EPS 1e-8
#define EQ(x, y) (abs((x)-(y)) < EPS)

typedef complex<double> Point;

struct Circle {
  Point c;
  double r;
};

int n;
Circle cs[100000];

vector<Point> CrossPointCC(Circle a, Circle b) {
  vector<Point> ret;
  double d = abs(b.c-a.c);
  double rc = (d*d + a.r*a.r - b.r*b.r) / (2*d);
  double dfr = a.r*a.r - rc*rc;
  if (EQ(dfr, 0.0)) dfr = 0.0;
  else if (dfr < 0.0) return ret;

  double rs = sqrt(dfr);

  Point sgn = (b.c-a.c) / d;
  ret.push_back(a.c + sgn * Point(rc, rs));
  if (dfr > 0.0) {
    ret.push_back(b.c + sgn * Point(rc, -rs));
  }
  return ret;
}

int main() {
  while (1) {
    scanf("%d", &n);
    if (n == 0) return 0;
    
    for (int i=0; i<n; i++) {
      double x, y;
      scanf("%lf,%lf", &x, &y);
      cs[i] = {Point(x, y), 1.0};
    }

    vector<Point> candidates;
    for (int i=0; i<n; i++) {
      for (int j=i+1; j<n; j++) {
        vector<Point> ps = CrossPointCC(cs[i], cs[j]);
        candidates.insert(candidates.end(), ps.begin(), ps.end());
      }
    }

    int ans = 1;
    for (int i=0; i<candidates.size(); i++) {
      Point p = candidates[i];
      if (p.X < 0.0 || p.X > 10.0) continue;
      if (p.Y < 0.0 || p.Y > 10.0) continue;

      int cnt = 0;
      for (int i=0; i<n; i++) {
        if (abs(cs[i].c-p) < 1.0+EPS) cnt++;
      }

      ans = max(ans, cnt);
    }

    printf("%d\n", ans);
  }
}