#include <bits/stdc++.h>
struct P {
  double x, y;
};
int main() {
  const int MAX_N = 100;
  const double EPS = 1e-9;
  int n;
  while (std::cin >> n, n) {
    P ps[MAX_N];
    for (int i = 0; i < n; i++) {
      scanf("%lf,%lf", &ps[i].x, &ps[i].y);
    }
    int ol[MAX_N];
    for (int i = 0; i < MAX_N; i++) {
      ol[i] = 0;
    }
    for (int i = 0; i < n; i++) {
      for (int j = i + 1; j < n; j++) {
        P p1 = ps[i], p2 = ps[j];
        double x_diff = p1.x - p2.x, y_diff = p1.y - p2.y,
               s_dist = x_diff * x_diff + y_diff * y_diff;
        if (s_dist - 4 < EPS) {
          ol[i]++;
          ol[j]++;
        }
      }
    }
    int max_ol = 0;
    for (int i = 0; i < n; i++) {
      max_ol = std::max(max_ol, ol[i]);
    }
    std::cout << max_ol + 1 << std::endl;
  }
}
