#include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toStr(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = INT_MAX / 10;
vector<complex<double> > cross_circles(complex<double> c1, double r1,
                                       complex<double> c2, double r2) {
  double d = abs(c2 - c1);
  if (((r1 + r2) - (d) <= -EPS) || ((d) - (fabs(r1 - r2)) <= -EPS)) {
    return vector<complex<double> >();
  }
  double l = 0.5 * ((r1 * r1 - r2 * r2) / d + d);
  double h = sqrt(r1 * r1 - l * l);
  vector<complex<double> > ret(2);
  ret[0] = complex<double>(l, +h) * (c2 - c1) / d + c1;
  ret[1] = complex<double>(l, -h) * (c2 - c1) / d + c1;
  return ret;
}
int main() {
  int n;
  while (cin >> n, n) {
    vector<complex<double> > circle(n);
    double x, y;
    char c;
    for (int i = (0); i <= ((n)-1); ++i) {
      cin >> x >> c >> y;
      circle[i] = complex<double>(x, y);
    }
    vector<complex<double> > points;
    for (int i = (0); i <= ((n - 1) - 1); ++i) {
      for (int j = (i + 1); j <= (n - 1); ++j) {
        vector<complex<double> > vp =
            cross_circles(circle[i], 1.0, circle[j], 1.0);
        int size = vp.size();
        for (int k = (0); k <= ((size)-1); ++k) {
          points.push_back(vp[k]);
        }
      }
    }
    int size = points.size(), ans = 0;
    for (int i = (0); i <= ((size)-1); ++i) {
      int count = 0;
      for (int j = (0); j <= ((n)-1); ++j) {
        if (((abs(points[i] - circle[j])) - (1.0) < +EPS)) {
          count++;
        }
      }
      ans = max(ans, count);
    }
    cout << ans << endl;
  }
  return 0;
}
