#include <bits/stdc++.h>
void mainLoop(int num) {
  double *x = new double[num];
  double *y = new double[num];
  char buf[256], *bufx, *bufy, *err;
  for (int i = 0; i < num; i++) {
    scanf("%s", buf);
    bufx = strtok(buf, ",");
    bufy = strtok(NULL, ",");
    x[i] = strtod(bufx, &err);
    y[i] = strtod(bufy, &err);
  }
  int max = 0;
  for (int i = 0; i < num; i++) {
    int cnt = 0;
    for (int j = 0; j < num; j++) {
      double r = (x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]);
      if (r <= 4) {
        cnt++;
      }
    }
    if (cnt > max) {
      max = cnt;
    }
  }
  printf("%d\n", max);
  delete[] x;
  delete[] y;
}
int main() {
  int num;
  while (1) {
    scanf("%d", &num);
    if (num == 0) {
      break;
    }
    mainLoop(num);
  }
  return 0;
}
