#include <bits/stdc++.h>
int main() {
  double x[100], y[100];
  double A, h, c, X, Y;
  int n, i, j, k, m, M;
  while (scanf("%d", &n), n) {
    M = 0;
    for (i = 0; i < n; i++) scanf("%lf,%lf", x + i, y + i);
    for (i = 0; i < n; i++) {
      for (j = i + 1; j < n; j++) {
        A = hypot(x[i] - x[j], y[i] - y[j]) / 2;
        if (A <= 1) {
          c = atan2(y[i] - y[j], x[i] - x[j]);
          h = sqrt(1 - A * A);
          X = x[j] + A * cos(c) - h * sin(c);
          Y = y[j] + A * sin(c) + h * cos(c);
          for (m = 0, k = 0; k < n; k++) {
            if (k != i && k != j)
              if (hypot(X - x[k], Y - y[k]) <= 1) m++;
          }
          if (m > M) M = m;
          X = x[j] + A * cos(c) + h * sin(c);
          Y = y[j] + A * sin(c) - h * cos(c);
          for (m = 0, k = 0; k < n; k++) {
            if (k != i && k != j)
              if (hypot(X - x[k], Y - y[k]) <= 1) m++;
          }
          if (m > M) M = m;
        }
      }
    }
    printf("%d\n", M + 2);
  }
  return 0;
}
