#include <bits/stdc++.h>
int main(void) {
  int n;
  double x[100], y[100];
  int isHit[100][100];
  int c, max;
  while (scanf("%d", &n), n != 0) {
    for (int i = 0; i < n; i++) {
      scanf("%lf,%lf", &x[i], &y[i]);
      for (int j = 0; j <= i; j++) {
        double dx, dy;
        dx = x[j] - x[i];
        dy = y[j] - y[i];
        isHit[j][i] = isHit[i][j] = sqrt(dx * dx + dy * dy) > 2.0 ? 0 : 1;
      }
    }
    max = 0;
    for (int i = 0; i < n; i++) {
      c = 0;
      for (int j = 0; j < n; j++) {
        c += isHit[i][j];
      }
      if (c > max) max = c;
    }
    printf("%d\n", max);
  }
  return 0;
}
