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