#include <bits/stdc++.h>
typedef struct {
  int n;
  double x;
  double y;
} seal;
int n;
seal s[128];
double sqr(double x) { return (x * x); }
int overlap(int from, seal ary[], int l) {
  int i, j;
  for (i = from; i < n; i++) {
    for (j = 0; j < l; j++) {
      if (ary[j].n == i ||
          4 <= sqr(ary[j].x - s[i].x) + sqr(ary[j].y - s[i].y)) {
        break;
      }
    }
    if (j == l) {
      ary[l] = s[i];
      return (overlap(i + 1, ary, l + 1));
    }
  }
  return (l);
}
int main() {
  seal ary[128];
  int cnt;
  int maxi;
  int i, j;
  while (scanf("%d", &n), n) {
    for (i = 0; i < n; i++) {
      scanf("%lf,%lf", &s[i].x, &s[i].y);
      s[i].n = i;
    }
    maxi = 0;
    for (i = 0; i < n; i++) {
      ary[0] = s[i];
      for (j = 0; j < n; j++) {
        cnt = overlap(j, ary, 1);
        if (maxi < cnt) {
          maxi = cnt;
        }
      }
    }
    printf("%d\n", maxi);
  }
  return (0);
}
