#include <bits/stdc++.h>
bool isCollision(double x1, double y1, double x2, double y2) {
  return (((x1 - x2) * (x1 - x2)) + ((y1 - y2) * (y1 - y2)) <=
          ((1 * 2) * (1 * 2)));
}
int main(void) {
  int n;
  double x[100], y[100];
  int count;
  int set[100];
  int answer;
  while (1) {
    scanf("%d", &n);
    if (n == 0) {
      break;
    }
    for (int i = 0; i < n; i++) {
      scanf("%lf,%lf", &x[i], &y[i]);
    }
    answer = 0;
    for (int i = 0; i < n; i++) {
      set[0] = i;
      count = 1;
      for (int j = 0; j < n; j++) {
        if (i != j) {
          bool flag = false;
          for (int k = 0; k < count; k++) {
            if (isCollision(x[set[k]], y[set[k]], x[j], y[j]) == true) {
              flag = true;
              break;
            }
          }
          if (flag == true) {
            set[count++] = j;
          }
        }
      }
      if (count > answer) {
        answer = count;
      }
    }
    printf("%d\n", answer);
  }
  return (0);
}
