#include <bits/stdc++.h>
using namespace std;
vector<complex<double> > intersection(complex<double> a, complex<double> b) {
  vector<complex<double> > res;
  if (abs(abs(b - a) - 2.0) < (1e-5)) {
    complex<double> c = a + b;
    res.push_back(complex<double>(c.real() / 2.0, c.imag() / 2.0));
  } else if (abs(b - a) < 2.0) {
    complex<double> ab = b - a;
    complex<double> nv1 = (ab * complex<double>(0, +1)) / abs(ab);
    complex<double> nv2 = (ab * complex<double>(0. - 1)) / abs(ab);
    complex<double> c = a + complex<double>(ab.real() / 2.0, ab.imag() / 2.0);
    double d = sqrt(1 - pow(abs(ab) / 2.0, 2));
    res.push_back(c + nv1 * d);
    res.push_back(c + nv2 * d);
  }
  return res;
}
int main() {
  while (true) {
    int n;
    cin >> n;
    if (!n) break;
    complex<double> p[100];
    for (int i = (0); i < (n); i++) {
      double a, b;
      scanf("%lf,%lf", &a, &b);
      p[i] = complex<double>(a, b);
    }
    int ans = 1;
    for (int i = (0); i < (n); i++) {
      for (int j = (i + 1); j < (n); j++) {
        vector<complex<double> > v = intersection(p[i], p[j]);
        if (v.empty()) continue;
        int cnt1 = 2, cnt2 = 2;
        for (int k = (0); k < (n); k++)
          if (i != k && j != k) {
            if (abs(v[0] - p[k]) - 1.0 < (1e-5)) cnt1++;
            if (v.size() == 2 && abs(v[1] - p[k]) - 1.0 < (1e-5)) cnt2++;
          }
        ans = max(ans, max(cnt1, cnt2));
      }
    }
    cout << ans << endl;
  }
  return 0;
}
