#include <bits/stdc++.h>
using namespace std;
template <class _T>
_T MAX(_T p1, _T p2) {
  return (p1 > p2) ? p1 : p2;
}
template <class _T>
_T MIN(_T p1, _T p2) {
  return (p1 < p2) ? p1 : p2;
}
bool circle_cross(complex<double> p1, complex<double> p2, double r,
                  complex<double> &cp1, complex<double> &cp2) {
  double rd, rd2;
  complex<double> pd = p2 - p1;
  rd = abs(pd);
  if (rd == 0 || rd > r * 2) return false;
  rd2 = rd / 2;
  complex<double> pl(rd2, sqrt(r * r - rd2 * rd2));
  cp1 = p1 + pl * polar(1.0, arg(pd));
  cp2 = p1 + conj(pl) * polar(1.0, arg(pd));
  return true;
}
void solve(vector<complex<double> > &v) {
  int n = v.size();
  vector<complex<double> > vc;
  for (int i = (0); i < (0 + n); ++i) vc.push_back(v[i]);
  for (int i = (0); i < (0 + n - 1); ++i) {
    for (int j = i + 1; j < n; j++) {
      ;
      complex<double> cp1, cp2;
      if (circle_cross(v[i], v[j], 1, cp1, cp2)) {
        vc.push_back(cp1);
        vc.push_back(cp2);
      }
    }
  }
  int max = 1;
  for (__typeof__((vc).begin()) it = (vc).begin(); it != (vc).end(); ++it) {
    int count = 0;
    complex<double> &pc = *it;
    ;
    for (int i = (0); i < (0 + n); ++i) {
      if (abs(norm(v[i] - pc) - 1.0 * 1.0) <= (1e-9)) count++;
    }
    max = MAX(max, count);
  }
  cout << max << endl;
  return;
}
int main() {
  int n;
  double x, y;
  char c;
  while (cin >> n, n) {
    vector<complex<double> > v;
    for (int i = (0); i < (0 + n); ++i) {
      cin >> x >> c >> y;
      v.push_back(complex<double>(x, y));
    }
    solve(v);
  }
  return 0;
}
