#include <bits/stdc++.h>
using namespace std;
class Point {
 public:
  double y, x;
  Point() { y = x = 0.0; }
  Point(double y0, double x0) {
    y = y0;
    x = x0;
  }
  double dot(const Point& p) const { return y * p.y + x * p.x; }
  double cross(const Point& p) const { return x * p.y - y * p.x; }
  Point operator+(const Point& p) const { return Point(y + p.y, x + p.x); }
  Point operator-(const Point& p) const { return Point(y - p.y, x - p.x); }
  Point operator*(double a) const { return Point(y * a, x * a); }
  Point operator/(double a) const { return Point(y / a, x * a); }
};
const double EPS = 1.0e-5;
vector<Point> circlesIntersection(const Point& p1, double r1, const Point& p2,
                                  double r2) {
  double y = p2.y - p1.y;
  double x = p2.x - p1.x;
  double a = (y * y + x * x + r1 * r1 - r2 * r2) / 2;
  double b = (y * y + x * x) * r1 * r1 - a * a;
  if (y * y + x * x < EPS || b < -EPS) return vector<Point>(0);
  if (b < EPS)
    return vector<Point>(1, Point(y, x) * (a / (y * y + x * x)) + p1);
  vector<Point> ret(2, Point(x * sqrt(b), -y * sqrt(b)));
  ret[1] = ret[1] * -1;
  for (int i = 0; i < 2; ++i)
    ret[i] = (ret[i] + Point(y, x) * a) / (y * y + x * x) + p1;
  return ret;
}
int main() {
  for (;;) {
    int n;
    cin >> n;
    if (n == 0) return 0;
    vector<Point> p(n);
    for (int i = 0; i < n; ++i) {
      char c;
      cin >> p[i].x >> c >> p[i].y;
    }
    int ret = 1;
    for (int i = 0; i < n; ++i) {
      for (int j = i + 1; j < n; ++j) {
        vector<Point> p2 = circlesIntersection(p[i], 1, p[j], 1);
        for (unsigned k = 0; k < p2.size(); ++k) {
          int tmp = 0;
          for (int l = 0; l < n; ++l) {
            if (pow(p[l].y - p2[k].y, 2) + pow(p[l].x - p2[k].x, 2) < 1 + EPS)
              ++tmp;
          }
          ret = max(ret, tmp);
        }
      }
    }
    cout << ret << endl;
  }
}
