#include <bits/stdc++.h>
int main() {
  int n, i, j, l, max, c;
  double x[310], y[310], k, s, t, a, b, e = 1e-6;
  while (scanf("%d", &n), n) {
    for (i = max = 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 = (x[i] - x[j]) / 2;
        b = (y[i] - y[j]) / 2;
        if (hypot(a, b) - e > 1) continue;
        k = tan(acos(hypot(a, b)));
        s = x[j] + a + k * b;
        t = y[j] + b - k * a;
        for (l = c = 0; l < n; l++) {
          if (hypot(x[l] - s, y[l] - t) - e < 1) c++;
        }
        if (max < c) max = c;
        s = x[j] + a - k * b;
        t = y[j] + b + k * a;
        for (l = c = 0; l < n; l++) {
          if (hypot(x[l] - s, y[l] - t) - e < 1) c++;
        }
        if (max < c) max = c;
      }
    }
    printf("%d\n", max);
  }
  return 0;
}
