#include <bits/stdc++.h>
int p[105], rank[105];
void make_set(int x) { p[x] = x, rank[x] = 0; }
void link(int x, int y) {
  if (rank[x] > rank[y])
    p[y] = x;
  else {
    p[x] = y;
    if (rank[x] == rank[y]) rank[y] = rank[y] + 1;
  }
}
int find_set(int x) {
  if (x != p[x]) p[x] = find_set(p[x]);
  return p[x];
}
void union_set(int x, int y) { link(find_set(x), find_set(y)); }
double x[105], y[105];
int f[105];
int main() {
  int i, j, n;
  double d, dx, dy;
  while (1) {
    scanf("%d", &n);
    if (!n) break;
    for (i = 0; i < n; i++) {
      scanf("%lf,%lf", x + i, y + i);
      make_set(i);
    }
    for (i = 0; i < n; i++) {
      for (j = i + 1; j < n; j++) {
        dx = x[i] - x[j], dy = y[i] - y[j];
        d = dx * dx + dy * dy;
        if (fabs(d - 4.0) <= 1.0e-8 || d <= 4.0) {
          if (find_set(i) != find_set(j)) union_set(i, j);
        }
      }
    }
    memset(f, 0, sizeof(f));
    for (i = 0; i < n; i++) f[p[i]]++;
    for (j = -1, i = 0; i < n; i++)
      if (f[i] > j) j = f[i];
    printf("%d\n", j);
  }
  return 0;
}
