#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-12;
class C {
 public:
  complex<double> p;
  double r;
  C() {}
  C(const complex<double> _p, double _r) {
    p = _p;
    r = _r;
  }
};
vector<complex<double> > crosspointCC(const C &c1, const C &c2) {
  vector<complex<double> > res;
  double d = abs(c1.p - c2.p);
  double rc = (d * d + c1.r * c1.r - c2.r * c2.r) / (2 * d);
  double dfr = c1.r * c1.r - rc * rc;
  if ((abs((dfr) - (0.0)) < EPS))
    dfr = 0.0;
  else if (dfr < 0.0)
    return res;
  double rs = sqrt(dfr);
  complex<double> diff = (c2.p - c1.p) / d;
  res.push_back(c1.p + diff * complex<double>(rc, rs));
  res.push_back(c1.p + diff * complex<double>(rc, -rs));
  return res;
}
int main() {
  int N;
  while (cin >> N && N) {
    vector<C> cs(N);
    for (int i = 0; i < (int)(N); ++i) {
      double x, y;
      scanf("%lf,%lf", &x, &y);
      cs[i] = C(complex<double>(x, y), 1.0);
    }
    int ans = 0;
    for (int i = 0; i < (int)(N); ++i) {
      for (int j = (int)(i + 1); j < (int)(N); ++j) {
        vector<complex<double> > ps = crosspointCC(cs[i], cs[j]);
        for (int k = 0; k < (int)(ps.size()); ++k) {
          int cnt = 0;
          for (int l = 0; l < (int)(N); ++l)
            if (abs(ps[k] - cs[l].p) < 1.0 + EPS) ++cnt;
          ans = max(ans, cnt);
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}
