#include <bits/stdc++.h>
using namespace std;
static const double PI = acos(-1);
class Point {
 public:
  double x, y;
  Point(double x = 0, double y = 0) : x(x), y(y) {}
  Point operator+(Point p) { return Point(x + p.x, y + p.y); }
  Point operator-(Point p) { return Point(x - p.x, y - p.y); }
  Point operator*(double a) { return Point(x * a, y * a); }
  Point operator/(double a) { return Point(x / a, y / a); }
  double abs() { return sqrt(norm()); }
  double norm() { return x * x + y * y; }
  void rotate(double s, Point g = Point(0.0, 0.0)) {
    x = x - g.x;
    y = y - g.y;
    double nx = x * cos(s) - y * sin(s);
    double ny = x * sin(s) + y * cos(s);
    x = nx + g.x;
    y = ny + g.y;
  }
  bool operator<(const Point &p) const { return x != p.x ? x < p.x : y < p.y; }
  bool operator==(const Point &p) const {
    return fabs(x - p.x) < (1e-10) && fabs(y - p.y) < (1e-10);
  }
};
double getDistance(Point a, Point b) {
  return sqrt(pow(a.x - b.x, 2.0) + pow(a.y - b.y, 2.0));
}
class Circle {
 public:
  Point o;
  double r;
  Circle(Point o = Point(0.0, 0.0), double r = 0.0) : o(o), r(r) {}
  double area() { return r * r * PI; }
};
int getCrossState(Circle a, Circle b) {
  double x = getDistance(a.o, b.o);
  if (x + b.r < a.r)
    return 2;
  else if (x + a.r < b.r)
    return -2;
  else if (x <= a.r + b.r)
    return 1;
  else
    return 0;
}
vector<Point> getCrossPoints(Circle a, Circle b) {
  vector<Point> res;
  if (getCrossState(a, b) != 1) {
    return res;
  }
  double n = getDistance(a.o, b.o);
  double rate = b.r / (a.r + b.r);
  n *= rate;
  double h = sqrt(abs(b.r * b.r - n * n));
  Point g = b.o + ((a.o - b.o) * rate);
  Point gb = b.o - g;
  gb.rotate(PI / 2.0);
  res.push_back(g + gb * (h / gb.abs()));
  if (abs(h) < (1e-10)) return res;
  gb.rotate(PI);
  res.push_back(g + gb * (h / gb.abs()));
  return res;
}
int main() {
  Circle t[100];
  vector<Point> crosspoints, tmp;
  int n, cnt, ans;
  char ch;
  while (cin >> n) {
    if (n == 0) break;
    crosspoints.clear();
    tmp.clear();
    for (int i = 0; i < n; i++) {
      cin >> t[i].o.x >> ch >> t[i].o.y;
      t[i].r = 1.0;
      for (int j = i - 1; j >= 0; j--) {
        tmp = getCrossPoints(t[i], t[j]);
        for (int k = 0; k < (int)tmp.size(); k++) {
          if (tmp[k].x < 0.0 || tmp[k].y < 0.0) continue;
          if (tmp[k].x > 10.0 || tmp[k].y > 10.0) continue;
          crosspoints.push_back(tmp[k]);
        }
      }
    }
    crosspoints.push_back(Point(0.0, 0.0));
    crosspoints.push_back(Point(10.0, 0.0));
    crosspoints.push_back(Point(0.0, 10.0));
    crosspoints.push_back(Point(10.0, 10.0));
    ans = 0;
    for (int i = 0; i < (int)crosspoints.size(); i++) {
      cnt = 0;
      for (int j = 0; j < n; j++) {
        if (getDistance(crosspoints[i], t[j].o) <= t[j].r) cnt++;
      }
      ans = max(ans, cnt);
    }
    cout << ans << endl;
  }
  return 0;
}
