#include <bits/stdc++.h>
int main(void) {
  double circle[100][2];
  int flag[100][100];
  int n;
  int i, j, k;
  double d;
  int num[100];
  int max;
  int flg;
  while (1) {
    scanf("%d", &n);
    if (n == 0) {
      break;
    }
    for (i = 0; i < n; i++) {
      scanf("%lf,%lf", &circle[i][0], &circle[i][1]);
    }
    memset(flag, 0, sizeof(flag));
    for (i = 0; i < n; i++) {
      for (j = i; j < n; j++) {
        if (i == j) {
          flag[i][j] = 1;
        } else {
          d = (circle[i][0] - circle[j][0]) * (circle[i][0] - circle[j][0]) +
              (circle[i][1] - circle[j][1]) * (circle[i][1] - circle[j][1]);
          if (d <= (double)4.0) {
            flag[i][j] = flag[j][i] = 1;
          }
        }
      }
    }
    do {
      flg = 0;
      for (i = 0; i < n; i++) {
        for (j = i; j < n; j++) {
          if (i != j && flag[i][j] == 1) {
            for (k = 0; k < n; k++) {
              if (flag[j][k] == 1) {
                flag[i][k] = 1;
                flag[j][k] = 0;
                flg = 1;
              }
            }
          }
        }
      }
    } while (flg == 1);
    memset(num, 0, sizeof(num));
    for (i = 0; i < n; i++) {
      for (j = 0; j < n; j++) {
        num[i] += flag[i][j];
      }
    }
    max = 0;
    for (i = 0; i < n; i++) {
      if (max < num[i]) {
        max = num[i];
      }
    }
    printf("%d\n", max);
  }
  return (0);
}
