#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
double calc(complex<double> x, complex<double> y) {
  double dx = (x.real() - y.real()) * (x.real() - y.real());
  double dy = (x.imag() - y.imag()) * (x.imag() - y.imag());
  return dx + dy;
}
signed main() {
  long long int n;
  while (cin >> n, n) {
    vector<complex<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] = complex<double>(x, y);
    }
    for (long long int(i) = (0); (i) < (n); (i)++) {
      long long int cnt = 0;
      for (long long int(j) = (0); (j) < (n); (j)++) {
        double d = calc(v[i], v[j]);
        if (d <= 4) cnt++;
      }
      ma = max(cnt, ma);
    }
    cout << ma << endl;
  }
  return 0;
}
