#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-12;
const double PI = acos(-1.0);
const int INF = INT_MAX / 10;
complex<double> center(complex<double> a, complex<double> b) {
  return complex<double>((a.real() + b.real()) / 2, (a.imag() + b.imag()) / 2);
}
int main() {
  int n;
  while (cin >> n, n) {
    vector<complex<double> > points(n);
    double x, y;
    char c;
    for (int i = (0); i <= ((n)-1); ++i) {
      cin >> x >> c >> y;
      points[i] = complex<double>(x, y);
    }
    vector<vector<complex<double> > > cpoints(n, vector<complex<double> >(n));
    for (int i = (0); i <= ((n)-1); ++i) {
      for (int j = (0); j <= ((n)-1); ++j) {
        cpoints[i][j] = center(points[i], points[j]);
      }
    }
    int ans = 0;
    for (int i = (0); i <= ((n)-1); ++i) {
      for (int j = (0); j <= ((n)-1); ++j) {
        int tmp = 0;
        for (int k = (0); k <= ((n)-1); ++k) {
          if (((abs(cpoints[i][j] - points[k])) - (1.0) <= -EPS)) {
            tmp++;
          }
        }
        ans = max(ans, tmp);
      }
    }
    cout << ans << endl;
  }
  return 0;
}
