#include <bits/stdc++.h>
int N, i, j, u[100], r[100], R;
double P[100][2];
int pa(int n) { return u[n] = (u[n] == n ? n : pa(u[n])); }
void un(int a, int b) { u[pa(a)] = pa(b); }
int dis(double a[2], double b[2]) {
  double x = a[0] - b[0], y = a[1] - b[1];
  return ((x * x + y * y) - 4.0 <= 0.000001) ? 1 : 0;
}
int main() {
  for (; scanf("%d", &N), N;) {
    R = 0;
    memset(r, 0, sizeof(r));
    for (i = 0; i < N; i++) u[i] = i;
    for (i = 0; i < N; i++) {
      scanf("%lf,%lf", &P[i][0], &P[i][1]);
      for (j = 0; j < i; j++)
        if (dis(P[j], P[i])) un(i, j);
    }
    for (i = 0; i < N; i++) r[pa(u[i])]++;
    for (i = 0; i < N; i++) R = R > r[i] ? R : r[i];
    printf("%d\n", R);
  }
  return 0;
}
