#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 29;
const double EPS = 1e-8;
pair<complex<double>, complex<double> > circle_circle_intersect(
    const complex<double>& c1, const double& r1, const complex<double>& c2,
    const double& r2) {
  complex<double> A = conj(c2 - c1),
                  B = (r2 * r2 - r1 * r1 - (c2 - c1) * conj(c2 - c1)),
                  C = r1 * r1 * (c2 - c1);
  complex<double> D = B * B - 4.0 * A * C;
  complex<double> z1 = (-B + sqrt(D)) / (2.0 * A) + c1,
                  z2 = (-B - sqrt(D)) / (2.0 * A) + c1;
  return pair<complex<double>, complex<double> >(z1, z2);
}
int main() {
  int n;
  while (scanf("%d", &n), n) {
    complex<double> points[n];
    for (int i = 0; i < (int)n; ++i) {
      double x, y;
      scanf("%lf,%lf", &x, &y);
      points[i] = complex<double>(x, y);
    }
    vector<complex<double> > v;
    for (int i = 0; i < (int)n - 1; ++i) {
      for (int j = i + 1; j < n; ++j) {
        complex<double> p = points[i];
        complex<double> q = points[j];
        if (norm(p - q) <= 2 + EPS) {
          pair<complex<double>, complex<double> > ppp =
              circle_circle_intersect(p, 1, q, 1);
          v.push_back(ppp.first);
          v.push_back(ppp.second);
        }
      }
    }
    int res = 0;
    for (__typeof((v).begin()) it = (v).begin(); it != (v).end(); ++it) {
      int tmp = 0;
      for (int i = 0; i < (int)n; ++i)
        if (norm((*it) - points[i]) <= 1 + EPS) ++tmp;
      res = max(res, tmp);
    }
    cout << res << endl;
  }
}
