#include <bits/stdc++.h>
using namespace std;
complex<double> p[100];
int n;
vector<complex<double> > cross(complex<double> a, complex<double> b) {
  vector<complex<double> > res;
  if (abs(abs(b - a) - 2.0) < (1e-5)) {
    complex<double> c = a + b;
    res.push_back(complex<double>(c.real() / 2, c.imag() / 2));
  } else if (abs(b - a) < 2.0) {
    complex<double> ab = b - a;
    complex<double> center = a + complex<double>(ab.real() / 2, ab.imag() / 2);
    complex<double> un1 = (ab * complex<double>(0, +1)) / abs(ab);
    complex<double> un2 = (ab * complex<double>(0, -1)) / abs(ab);
    double dist = sqrt(1 - pow(abs(ab) / 2, 2));
    complex<double> c1 = center + un1 * dist;
    complex<double> c2 = center + un2 * dist;
    res.push_back(c1);
    res.push_back(c2);
  }
  return res;
}
int solve() {
  int ans = 1;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      vector<complex<double> > c = cross(p[i], p[j]);
      if (c.empty()) continue;
      int cnt1 = 2, cnt2 = 2;
      for (int k = 0; k < n; k++) {
        if (i == k || j == k) continue;
        if (abs(c[0] - p[k]) - 1.0 < (1e-5)) cnt1++;
        if (c.size() == 2 && abs(c[1] - p[k]) - 1.0 < (1e-5)) cnt2++;
      }
      ans = max(ans, max(cnt1, cnt2));
    }
  }
  return ans;
}
int main() {
  while (1) {
    cin >> n;
    if (n == 0) break;
    for (int i = 0; i < n; i++) {
      double x, y;
      cin >> x;
      getchar();
      cin >> y;
      p[i] = complex<double>(x, y);
    }
    cout << solve() << endl;
  }
  return 0;
}
