#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);
}
double distance_between_point_line(double x, double y, double a, double b,
                                   double c) {
  return abs(a * x + b * y + c) / sqrt(a * a + b * b);
}
vector<pair<double, double> > cross_points_of_circle_line(double x, double y,
                                                          double r, double a,
                                                          double b, double c,
                                                          double cx,
                                                          double cy) {
  vector<pair<double, double> > res;
  double d = distance_between_point_line(x, y, a, b, c);
  if (d > r) return res;
  double for_unit = sqrt(a * a + b * b);
  double h = sqrt(r * r - d * d);
  int sign[] = {1, -1};
  for (int i = 0; i < 2; ++i) {
    double xx = cx + sign[i] * h * a / for_unit;
    double yy = cy + sign[i] * h * -b / for_unit;
    res.push_back(make_pair(xx, yy));
  }
  return res;
}
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);
    int ans = 1;
    for (int i = 0; i < n - 1; ++i) {
      for (int j = i + 1; j < n; ++j) {
        double a, b, c;
        a = x[i] - x[j];
        b = y[i] - y[j];
        c = -(x[i] * x[i] - x[j] * x[j] + y[i] * y[i] - y[j] * y[j]) / 2;
        vector<pair<double, double> > cross = cross_points_of_circle_line(
            x[i], y[i], 1, a, b, c, (x[i] + x[j]) / 2, (y[i] + y[j]) / 2);
        if (cross.size() > 0 && ans < 2) ans = 2;
        vector<int> counter;
        for (int k = 0; k < cross.size(); ++k) counter.push_back(2);
        for (int k = 0; k < n; ++k) {
          if (k == i || k == j) continue;
          for (int l = 0; l < cross.size(); ++l) {
            if (distance(cross[l].first, cross[l].second, x[k], y[k]) - 1.0 <
                1e-5)
              ++counter[l];
          }
        }
        for (int k = 0; k < counter.size(); ++k) ans = max(ans, counter[k]);
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}
