#include <bits/stdc++.h>
using namespace std;
struct Point {
  long double px, py;
};
struct Circle {
  Point p;
  long double r;
};
Point pol(long double r, long double d) {
  return Point{cosl(d) * r, sinl(d) * r};
}
long double arg(const Point& a) { return atan2l(a.py, a.px); }
long double norm(const Point& a) { return a.px * a.px + a.py * a.py; }
long double abs(const Point& a) { return sqrtl(norm(a)); }
Point Minus(Point a, Point b) { return Point{a.px - b.px, a.py - b.py}; }
Point Plus(Point a, Point b) { return Point{a.px + b.px, a.py + b.py}; }
long double dst(const Point& a, const Point& b) { return abs(Minus(b, a)); }
pair<Point, Point> crp(Circle c1, Circle c2) {
  double d = abs(Minus(c1.p, c2.p));
  double a = acos((c1.r * c1.r + d * d - c2.r * c2.r) / (2 * c1.r * d));
  double t = arg(Minus(c2.p, c1.p));
  return make_pair(Plus(c1.p, pol(c1.r, t + a)), Plus(c1.p, pol(c1.r, t - a)));
}
int main() {
  Circle x[100];
  int n;
  vector<Point> y;
  while (true) {
    cin >> n;
    char ch;
    if (n == 0) break;
    for (int i = 0; i < n; i++) {
      cin >> x[i].p.px >> ch >> x[i].p.py;
      x[i].r = 1.0l;
    }
    for (int i = 0; i < n; i++) {
      for (int j = i + 1; j < n; j++) {
        y.push_back(crp(x[i], x[j]).first);
        y.push_back(crp(x[i], x[j]).second);
      }
    }
    int maxn = 0;
    for (int i = 0; i < y.size(); i++) {
      int cnt = 0;
      for (int j = 0; j < n; j++) {
        if (dst(y[i], x[j].p) <= 1.0l) {
          cnt++;
        }
      }
      maxn = max(maxn, cnt);
    }
    cout << maxn << endl;
  }
  return 0;
}
