#include <bits/stdc++.h>
using namespace std;
double distance(double x1, double y1, double x2, double y2) {
  double dx = x1 - x2;
  double dy = y1 - y2;
  return sqrt(dx * dx + dy * dy);
}
int main() {
  while (true) {
    int n;
    scanf("%d", &n);
    if (n == 0) break;
    double x[100];
    double y[100];
    for (int i = 0; i < n; ++i) scanf("%lf,%lf", x + i, y + i);
    set<int> crossSet[100];
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < n; ++j) {
        if (distance(x[i], y[i], x[j], y[j]) - 2 <= 10e-6)
          crossSet[i].insert(j);
      }
    }
    int c;
    int left = n;
    bool cut[100];
    fill(cut, cut + n, false);
    for (c = 1;; ++c) {
      for (int i = 0; i < n; ++i) {
        if (!cut[i] && crossSet[i].size() <= c) {
          cut[i] = true;
          --left;
          for (int j = 0; j < n; ++j) crossSet[j].erase(i);
        }
      }
      if (left == 0) break;
    }
    printf("%d\n", c);
  }
  return 0;
}
