#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 siita;
  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++) {
        if ((x[j] - cx) * (x[j] - cx) + (y[j] - cy) * (y[j] - cy) <= 1) {
          now++;
        } else {
          siita = atan2(y[j] - cy, x[j] - cx);
          nx = cx - cr * cos(siita);
          ny = cy - cr * cos(siita);
          ncx = (x[j] + nx) / 2;
          ncy = (y[j] + ny) / 2;
          ncr = (ncx - nx) * (ncx - nx) + (ncy - ny) * (ncy - ny);
          if (ncr <= 1) {
            cx = ncx;
            cy = ncy;
            cr = ncr;
            now++;
          }
        }
      }
      if (max < now) max = now;
    }
    printf("%d\n", max);
  }
  return 0;
}
