#include <bits/stdc++.h>
using namespace std;
struct Circle {
  complex<double> c;
  double r;
};
int n;
Circle cs[100000];
vector<complex<double> > CrossPointCC(Circle a, Circle b) {
  vector<complex<double> > ret;
  double d = abs(b.c - a.c);
  double rc = (d * d + a.r * a.r - b.r * b.r) / (2 * d);
  double dfr = a.r * a.r - rc * rc;
  if ((abs((dfr) - (0.0)) < 1e-8))
    dfr = 0.0;
  else if (dfr < 0.0)
    return ret;
  double rs = sqrt(dfr);
  complex<double> sgn = (b.c - a.c) / d;
  ret.push_back(a.c + sgn * complex<double>(rc, rs));
  if (dfr > 0.0) {
    ret.push_back(b.c + sgn * complex<double>(rc, -rs));
  }
  return ret;
}
int main() {
  while (1) {
    scanf("%d", &n);
    if (n == 0) return 0;
    for (int i = 0; i < n; i++) {
      double x, y;
      scanf("%lf,%lf", &x, &y);
      cs[i] = {complex<double>(x, y), 1.0};
    }
    vector<complex<double> > candidates;
    for (int i = 0; i < n; i++) {
      for (int j = i + 1; j < n; j++) {
        vector<complex<double> > ps = CrossPointCC(cs[i], cs[j]);
        candidates.insert(candidates.end(), ps.begin(), ps.end());
      }
    }
    int ans = 0;
    for (int i = 0; i < candidates.size(); i++) {
      complex<double> p = candidates[i];
      int cnt = 0;
      for (int i = 0; i < n; i++) {
        if (abs(cs[i].c - p) < 1.0 + 1e-8) cnt++;
      }
      ans = max(ans, cnt);
    }
    printf("%d\n", ans);
  }
}
