#include <bits/stdc++.h>
using namespace std;
long long int dy[] = {0, 0, 1, -1};
long long int dx[] = {1, -1, 0, 0};
long long int const MOD = 1000000007;
namespace std {
bool operator<(const complex<double>& a, const complex<double>& b) {
  return a.real() != b.real() ? a.real() < b.real() : a.imag() < b.imag();
}
}  // namespace std
long long int intersectCC(pair<complex<double>, double> c1,
                          pair<complex<double>, double> c2) {
  complex<double> c1p = c1.first, c2p = c2.first;
  double c1r = c1.second, c2r = c2.second;
  long double d = abs(c1p - c2p), r1 = c1r, r2 = c2r;
  if (r1 + r2 < d) return 0;
  if (abs(r1 + r2 - d) < (1e-10)) return -2;
  if (d + r2 < r1) return -3;
  return 2;
}
signed main() {
  long long int n;
  while (cin >> n, n) {
    vector<pair<complex<double>, double> > v(n);
    double x, y;
    long long int ma = 0;
    for (long long int(i) = (0); (i) < (n); (i)++) {
      scanf("%lf,%lf", &x, &y);
      v[i] = pair<complex<double>, double>(complex<double>(x, y), 1.0);
    }
    for (long long int(i) = (0); (i) < (n); (i)++) {
      long long int cnt = 1;
      for (long long int(j) = (0); (j) < (n); (j)++) {
        if (i == j) continue;
        long long int p = intersectCC(v[i], v[j]);
        if (p != 0) cnt++;
      }
      ma = max(cnt, ma);
    }
    cout << ma << endl;
  }
  return 0;
}
