#include <bits/stdc++.h>
int n;
double x[100];
double y[100];
int main(void) {
  int i, j, max, now;
  double cx, cy, cr;
  double nx, ny, ncx, ncy, ncr;
  double n_sin, n_cos, n_kyori;
  while (1) {
    scanf("%d", &n);
    if (n == 0) break;
    for (i = 0; i < n; i++) scanf("%lf,%lf", &x[i], &y[i]);
    max = 0;
    for (i = 0; i < n; i++) {
      cx = x[i];
      cy = y[i];
      cr = 0;
      now = 1;
      for (j = i + 1; j < n; j++) {
        n_kyori = sqrt((x[j] - cx) * (x[j] - cx) + (y[j] - cy) * (y[j] - cy));
        if (n_kyori > cr + 1e-9) {
          n_sin = (y[j] - cy) / n_kyori;
          n_cos = (x[j] - cx) / n_kyori;
          nx = cx - cr * n_cos;
          ny = cy - cr * n_sin;
          ncx = (x[j] + nx) / 2;
          ncy = (y[j] + ny) / 2;
          ncr = sqrt((ncx - nx) * (ncx - nx) + (ncy - ny) * (ncy - ny));
        } else {
          ncx = cx;
          ncy = cy;
          ncr = cr;
        }
        if (ncr - 1 <= 1e-9) {
          cx = ncx;
          cy = ncy;
          cr = ncr;
          now++;
        }
      }
      if (max < now) max = now;
    }
    printf("%d\n", max);
  }
  return 0;
}
