#include <bits/stdc++.h>
using namespace std;
int n;
char G[100][100];
char flag[100];
int check(int n) {
  int count;
  int result;
  bool loopflag;
  result = 0;
  do {
    loopflag = false;
    result++;
    for (int i = 0; i < n; i++) {
      count = 0;
      for (int j = 0; j < n; j++) {
        count += G[i][j];
      }
      if (count > 0) {
        loopflag = true;
      }
      if (count <= result) {
        for (int j = 0; j < n; j++) {
          G[i][j] = G[j][i] = 0;
        }
      }
    }
  } while (loopflag);
  return (result);
}
int main(void) {
  double x[100], y[100];
  while (1) {
    scanf("%d", &n);
    if (n == 0) {
      break;
    }
    memset(G, 0, sizeof(G));
    memset(flag, -1, sizeof(flag));
    for (int i = 0; i < n; i++) {
      scanf("%lf,%lf", &x[i], &y[i]);
    }
    for (int i = 0; i < n; i++) {
      for (int j = i + 1; j < n; j++) {
        if (((x[i] - x[j]) * (x[i] - x[j])) + ((y[i] - y[j]) * (y[i] - y[j])) <=
            4.0) {
          G[i][j] = G[j][i] = 1;
        }
      }
    }
    printf("%d\n", check(n));
  }
  return (0);
}
