#include <bits/stdc++.h>
enum { CCW = 1, CW = -1, ON = 0 };
using namespace std;
class Point {
 public:
  double x, y;
  Point() {}
  Point(double xx, double yy) : x(xx), y(yy) {}
};
class Line : public vector<Point> {
 public:
  Line(const Point &a, const Point &b) { push_back(a), push_back(b); }
};
class Segment : public Line {
 public:
  Segment(const Point &a, const Point &b) : Line(a, b) {}
};
class Polygon : public vector<Point> {};
class Circle {
 public:
  Point c;
  double r;
  Circle() {}
  Circle(const Point &cc, double rr) : c(cc), r(rr) {}
};
Point &operator+=(Point &a, const Point &b) {
  a.x += b.x, a.y += b.y;
  return a;
}
Point &operator-=(Point &a, const Point &b) {
  a.x -= b.x, a.y -= b.y;
  return a;
}
Point &operator*=(Point &a, double c) {
  a.x *= c, a.y *= c;
  return a;
}
Point &operator/=(Point &a, double c) {
  a.x /= c, a.y /= c;
  return a;
}
Point operator+(const Point &a, const Point &b) {
  Point c = a;
  return c += b;
}
Point operator-(const Point &a, const Point &b) {
  Point c = a;
  return c -= b;
}
Point operator*(double c, const Point &a) {
  Point b = a;
  return b *= c;
}
Point operator/(const Point &a, double c) {
  Point b = a;
  return b /= c;
}
bool operator<(const Point &a, const Point &b) {
  return (a.x == b.x) ? (a.y < b.y) : (a.x < b.x);
}
bool operator>(const Point &a, const Point &b) { return b < a; }
double dot(const Point &a, const Point &b) { return a.x * b.x + a.y * b.y; }
double cross(const Point &a, const Point &b) { return a.x * b.y - a.y * b.x; }
double norm2(const Point &a) { return dot(a, a); }
int ccw(const Point &a, Point b, Point c) {
  b -= a, c -= a;
  double rotdir = cross(b, c);
  if (rotdir > 1e-9) return CCW;
  if (rotdir < -1e-9) return CW;
  return ON;
}
inline void calc_abc(const Line &l, double &a, double &b, double &c) {
  a = l[0].y - l[1].y;
  b = l[1].x - l[0].x;
  c = l[0].x * l[1].y - l[1].x * l[0].y;
}
Point perp_foot(const Point &p, const Line &l) {
  double a, b, c;
  calc_abc(l, a, b, c);
  return p - (a * p.x + b * p.y + c) / (a * a + b * b) * Point(a, b);
}
int intersect(const Circle &c, const Line &l, Point *p = NULL,
              Point *q = NULL) {
  Point m = perp_foot(c.c, l);
  double d2 = norm2(c.c - m);
  if (c.r * c.r + 1e-9 < d2)
    return 0;
  else if (abs(c.r * c.r - d2) < 1e-9) {
    if (p && q) *p = *q = m;
    return 1;
  } else {
    if (p && q) {
      Point v;
      double n0 = norm2(l[0] - m), n1 = norm2(l[1] - m);
      if (n0 < n1)
        v = l[1] - m, n0 = n1;
      else
        v = l[0] - m;
      v *= sqrt((c.r * c.r - d2) / n0);
      *p = m + v, *q = m - v;
    }
    return 2;
  }
}
int intersect(const Circle &c, const Segment &s, Point *p = NULL,
              Point *q = NULL) {
  Point pp, qq;
  int n = intersect(c, Line(s[0], s[1]), &pp, &qq);
  if (n == 0)
    return 0;
  else if (n == 1) {
    if (dot(pp - s[0], pp - s[1]) < 1e-9) {
      if (p && q) *p = *q = pp;
      return 1;
    }
    return 0;
  } else {
    bool bp = (dot(pp - s[0], pp - s[1]) < 1e-9);
    bool bq = (dot(qq - s[0], qq - s[1]) < 1e-9);
    if (bp && bq) {
      if (p && q) *p = pp, *q = qq;
      return 2;
    }
    if (bp || bq) {
      if (p && q) *p = (bp ? pp : qq);
      return 1;
    }
    return 0;
  }
}
int intersect(const Circle &c1, const Circle &c2, Point *p = NULL,
              Point *q = NULL) {
  double d2 = norm2(c1.c - c2.c);
  if (d2 < 1e-9 && abs(c1.r - c2.r) < 1e-9)
    return -1;
  else if ((c1.r + c2.r) * (c1.r + c2.r) + 1e-9 < d2 ||
           d2 + 1e-9 < (c1.r - c2.r) * (c1.r - c2.r))
    return 0;
  else if (abs(c1.r + c2.r - d2) < 1e-9) {
    if (p && q) intersect(c1, Segment(c1.c, c2.c), p, q);
    return 1;
  } else {
    if (p && q) {
      double d = sqrt(d2);
      double a = (c1.r * c1.r - c2.r * c2.r + d2) / (2 * d);
      double h = sqrt(c1.r * c1.r - a * a);
      *p = *q = c1.c + a / d * (c2.c - c1.c);
      p->x += h * (c2.c.y - c1.c.y) / d;
      p->y -= h * (c2.c.x - c1.c.x) / d;
      q->x -= h * (c2.c.y - c1.c.y) / d;
      q->y += h * (c2.c.x - c1.c.x) / d;
    }
    return 2;
  }
}
int main() {
  Circle seal[100];
  for (int n; scanf("%d", &n), n;) {
    vector<Point> ps;
    for (int i = 0; i < n; i++) {
      scanf("%lf%*c%lf", &seal[i].c.x, &seal[i].c.y);
      seal[i].r = 1;
      Point t1, t2;
      for (int j = 0; j < i; j++) {
        int m = intersect(seal[i], seal[j], &t1, &t2);
        if (m >= 1) ps.push_back(t1);
        if (m >= 2) ps.push_back(t2);
      }
    }
    int cntmax = 0;
    for (int i = 0; i < ps.size(); i++) {
      int cnt = 0;
      for (int j = 0; j < n; j++) {
        if (norm2(ps[i] - seal[j].c) < seal[j].r * seal[j].r + 1e-9) cnt++;
      }
      cntmax = max(cntmax, cnt);
    }
    printf("%d\n", cntmax);
  }
  return 0;
}
