#include <bits/stdc++.h>
using namespace std;
long double dot(complex<long double> a, complex<long double> b) {
  return real(conj(a) * b);
}
long double cross(complex<long double> a, complex<long double> b) {
  return imag(conj(a) * b);
}
int main() {
  while (true) {
    int n;
    cin >> n;
    if (!n) break;
    complex<long double> ps[n];
    for (long long i = 0; i < n; ++i) {
      double x, y;
      scanf("%lf,%lf", &x, &y);
      ps[i] = complex<long double>(x, y);
    }
    int res = 1;
    for (long long i = 0; i < n; ++i)
      for (long long j = 0; j < i; ++j) {
        complex<long double> a = ps[i], b = ps[j];
        long double len = abs(b - a);
        if (len > 2.0 + 1e-13) continue;
        long double ang_ab = atan2(b.imag() - a.imag(), b.real() - a.real());
        long double ang_x = acos(len / 2.0);
        complex<long double> x =
            a + exp(complex<long double>(0, ang_ab + ang_x));
        complex<long double> y =
            a + exp(complex<long double>(0, ang_ab - ang_x));
        if (x.real() < 0.0 - 1e-13 || x.real() > 10.0 + 1e-13 ||
            x.imag() < 0.0 - 1e-13 || x.imag() > 10.0 + 1e-13)
          x = y;
        swap(x, y);
        if (x.real() < 0.0 - 1e-13 || x.real() > 10.0 + 1e-13 ||
            x.imag() < 0.0 - 1e-13 || x.imag() > 10.0 + 1e-13)
          x = y;
        int t = 0;
        for (long long k = 0; k < n; ++k) {
          if (abs(ps[k] - x) < 1.0 + 1e-13 || abs(ps[k] - y) < 1.0 + 1e-13) ++t;
        }
        res = max(res, t);
      }
    cout << res << endl;
  }
  return 0;
}
