#include <bits/stdc++.h>
int main(void) {
  int n;
  double circle[(200)][2];
  double d;
  int flag[(200)][(200)];
  int i, j, k;
  int overlap, max_overlap;
  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 <= 4.0) {
            flag[i][j] = flag[j][i] = 1;
          }
        }
      }
    }
    max_overlap = 1;
    for (i = 0; i < n; i++) {
      for (j = i; j < n - 1; j++) {
        overlap = 1;
        if (flag[i][j] > 0) {
          for (k = j + 1; k < n; k++) {
            overlap += flag[j][k];
          }
        }
        if (max_overlap < overlap) {
          max_overlap = overlap;
        }
      }
    }
    printf("%d\n", max_overlap);
  }
  return (0);
}
