#include <bits/stdc++.h>
using namespace std;
struct CPoint {
  CPoint() : x(-1), y(-1) {}
  CPoint(double x, double y) : x(x), y(y) {}
  double x, y;
};
struct CSeal {
  CSeal() : r(0) {}
  CSeal(double x, double y) : p(x, y), r(1.0) {}
  CPoint p;
  double r;
};
double Distance(const CPoint &a, const CPoint &b) {
  return sqrt(pow(b.x - a.x, 2.0) + pow(b.y - a.y, 2.0));
}
double Distance(const CSeal &a, const CSeal &b) { return Distance(a.p, b.p); }
pair<CPoint, CPoint> CrossPoints(const CSeal &a, const CSeal &b) {
  pair<CPoint, CPoint> ans;
  if (Distance(a, b) > 2) {
    ans.first.x = -1;
    ans.first.y = -1;
    ans.second.x = -1;
    ans.second.y = -1;
    return ans;
  }
  if (a.p.x == b.p.x) {
    double D = Distance(a, b);
    double off = sqrt(1 - pow((D / 2), 2));
    ans.first.x = a.p.x - off;
    ans.second.x = a.p.x + off;
    if (a.p.y >= b.p.y)
      ans.first.y = a.p.y - D / 2;
    else
      ans.first.y = b.p.y - D / 2;
    ans.second.y = ans.first.y;
  } else {
    double xa = a.p.x;
    double xb = b.p.x;
    double ya = a.p.y;
    double yb = b.p.y;
    double A = (xa + xb) / 2 - ((pow(yb, 2) - pow(ya, 2)) / (2 * (xa - xb)));
    double m = (yb - ya) / (xa - xb);
    double aVal = 1 + pow(m, 2);
    double bVal = m * (A - xb) - yb;
    double cVal = pow(A, 2) + pow(xb, 2) + pow(yb, 2) - 2 * xb * A - 1;
    ans.first.y = (-bVal + sqrt(pow(bVal, 2) - aVal * cVal)) / aVal;
    ans.second.y = (-bVal - sqrt(pow(bVal, 2) - aVal * cVal)) / aVal;
    ans.first.x = A + m * ans.first.y;
    ans.second.x = A + m * ans.second.y;
  }
  if (Distance(a, b) == 2) {
    ans.second.x = -1;
    ans.second.y = -1;
  }
  return ans;
}
int main(void) {
  while (true) {
    int n;
    unsigned int maxOverlapped = 0;
    vector<CSeal> vSeals;
    vector<CPoint> vCrossPoints;
    cin >> n;
    if (n == 0) break;
    for (int i = 0; i < n; ++i) {
      double x, y;
      cin >> x;
      cin.ignore(1);
      cin >> y;
      CSeal tmp(x, y);
      vSeals.push_back(tmp);
    }
    for (unsigned int i = 0; i < vSeals.size(); ++i) {
      for (unsigned int j = i; j < vSeals.size(); ++j) {
        if (i != j) {
          pair<CPoint, CPoint> cp;
          cp = CrossPoints(vSeals[i], vSeals[j]);
          if (cp.first.x >= 0) {
            vCrossPoints.push_back(cp.first);
          }
          if (cp.second.x >= 0) {
            vCrossPoints.push_back(cp.second);
          }
        }
      }
    }
    for (unsigned int i = 0; i < vCrossPoints.size(); ++i) {
      unsigned int overlapped = 0;
      for (unsigned int j = 0; j < vSeals.size(); ++j) {
        if (Distance(vCrossPoints[i], vSeals[j].p) <= 1 + 1.0e-12) {
          ++overlapped;
        }
      }
      maxOverlapped = max(maxOverlapped, overlapped);
    }
    cout << maxOverlapped << endl;
  }
  return 0;
}
