#include <bits/stdc++.h>
using namespace std;
bool same(complex<double> a, complex<double> b) {
  if ((a.imag() - b.imag()) * (a.imag() - b.imag()) +
          (a.real() - b.real()) * (a.real() - b.real()) <=
      4.0)
    return true;
  return false;
}
double dist(complex<double> a, complex<double> b) {
  return sqrt((a.imag() - b.imag()) * (a.imag() - b.imag()) +
              (a.real() - b.real()) * (a.real() - b.real()));
}
int n;
vector<complex<double> > p;
bool q(complex<double> a, complex<double> b) {
  if ((a.imag() - b.imag()) * (a.imag() - b.imag()) +
          (a.real() - b.real()) * (a.real() - b.real()) <=
      1.0)
    return true;
  return false;
}
int cal(complex<double> a, complex<double> b) {
  int ret = 0, rett = 0;
  double plus = 1 - dist(a, (a + b) * 0.5);
  complex<double> s =
      complex<double>(0, 1) * (b - a) / abs(b - a) * plus + (a + b) * 0.5;
  complex<double> t =
      complex<double>(0, -1) * (b - a) / abs(b - a) * plus + (a + b) * 0.5;
  for (int i = 0; i < n; i++) {
    if (q(s, p[i])) ret++;
    if (q(t, p[i])) rett++;
  }
  return max(ret, rett);
}
int main() {
  while (cin >> n, n) {
    p.clear();
    char c;
    for (int i = 0; i < n; i++) {
      double x, y;
      cin >> x >> c >> y;
      p.push_back(complex<double>(x, y));
    }
    int ans = 1;
    for (int i = 0; i < n; i++) {
      for (int j = i + 1; j < n; j++) {
        if (same(p[i], p[j])) {
          ans = max(cal(p[i], p[j]), ans);
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}
