#include <bits/stdc++.h>
double EPS = 1e-9;
double S(double x) { return x * x; }
double D(double x1, double y1, double x2, double y2) {
  return sqrt(S(x1 - x2) + S(y1 - y2));
}
double x[100], y[100];
int n;
int F(int i, int j, double px, double py) {
  int t = 2, k;
  for (k = 0; k < n; ++k)
    if (k - i && k - j && D(px, py, x[k], y[k]) - EPS < 1) ++t;
  return t;
}
int main() {
  double d, dx, dy, t1, t2;
  int i, j, r, t;
  while (scanf("%d", &n), n) {
    for (i = r = 0; i < n; ++i) scanf("%lf,%lf", x + i, y + i);
    for (i = 0; i < n; ++i)
      for (j = i + 1; j < n; ++j) {
        dx = x[i] - x[j];
        dy = y[i] - y[j];
        d = sqrt(dx * dx + dy * dy);
        if (d - EPS > 2) continue;
        t1 = atan2(dy, dx);
        t2 = acos(d / 2);
        if ((t = F(i, j, x[j] + cos(t1 + t2), y[j] + sin(t1 + t2))) > r) r = t;
        if ((t = F(i, j, x[j] + cos(t1 - t2), y[j] + sin(t1 - t2))) > r) r = t;
      }
    printf("%d\n", r);
  }
  return 0;
}
