#include <bits/stdc++.h>
using namespace std;
struct Circle {
  complex<double> center;
  double r;
  pair<complex<double>, complex<double> > intersection(const Circle &c) const {
    const double d = abs(c.center - center);
    const double cos_ = (d * d + r * r - c.r * c.r) / (2 * d);
    const double sin_ = sqrt(r * r - cos_ * cos_);
    const complex<double> e = (c.center - center) / d;
    return make_pair(center + e * complex<double>(cos_, sin_),
                     center + e * complex<double>(cos_, -sin_));
  }
  inline bool intersects(const Circle &c) const {
    return norm(center - c.center) <= pow(r + c.r, 2);
  }
  inline bool contains(const Circle &c) const {
    return abs(center - c.center) + c.r <= r;
  }
  inline bool contains(const complex<double> &v) const {
    return abs(center - v) <= r;
  }
};
int main() {
  while (true) {
    int N;
    cin >> N;
    if (!N) break;
    vector<Circle> circles(N);
    for (int i = 0; i < N; ++i) {
      double x, y;
      scanf("%lf,%lf", &x, &y);
      circles[i].center = complex<double>(x, y);
      circles[i].r = 1;
    }
    int ans = 0;
    for (int i = 0; i < N; ++i) {
      const Circle c1 = circles[i];
      for (int j = 0; j < i; ++j) {
        const Circle c2 = circles[j];
        if (!c1.intersects(c2)) continue;
        pair<complex<double>, complex<double> > vs = c1.intersection(c2);
        int cnt1 = 0, cnt2 = 0;
        for (int k = 0; k < N; ++k) {
          if (i == k || j == k) continue;
          if (circles[k].contains(vs.first)) ++cnt1;
          if (circles[k].contains(vs.second)) ++cnt2;
        }
        ans = max(ans, max(cnt1, cnt2) + 2);
      }
    }
    cout << ans << endl;
  }
  return 0;
}
