#include <bits/stdc++.h>
std::complex<double> p[101];
int n;
int main() {
  while (scanf("%d", &n)) {
    if (n == 0) break;
    for (int i = 0; i < n; i++) {
      double a, b;
      scanf("%lf,%lf", &a, &b);
      p[i].real(a);
      p[i].imag(b);
    }
    int max = 1;
    for (int i = 0; i < n; i++) {
      for (int j = i + 1; j < n; j++) {
        std::vector<std::complex<double> > v;
        if (std::abs(std::abs(p[j] - p[i]) - 2.0) < 1e-5) {
          std::complex<double> c = p[i] + p[j];
          v.push_back(std::complex<double>(c.real() / 2, c.imag() / 2));
        } else if (std::abs(p[j] - p[i]) < 2.0) {
          std::complex<double> xx = p[j] - p[i];
          std::complex<double> ce =
              p[i] + std::complex<double>(xx.real() / 2, xx.imag() / 2);
          std::complex<double> no1 =
              (ce * std::complex<double>(0, +1)) / std::abs(xx);
          std::complex<double> no2 =
              (ce * std::complex<double>(0, -1)) / std::abs(xx);
          double dis = sqrt(1 - pow(std::abs(xx) / 2, 2));
          v.push_back(ce + no1 * dis);
          v.push_back(ce + no2 * dis);
        }
        if (v.empty()) continue;
        int cnt1 = 2, cnt2 = 2;
        for (int k = 0; k < n; k++) {
          if (k == i || k == j) continue;
          if (std::abs(v[0] - p[k]) - 1.0 < 1e-5) {
            cnt1++;
          }
          if (v.size() == 2 && std::abs(v[1] - p[k]) - 1.0 < 1e-5) {
            cnt2++;
          }
        }
        if (cnt1 < cnt2) cnt1 = cnt2;
        if (cnt1 > max) max = cnt1;
      }
    }
    printf("%d\n", max);
  }
  return 0;
}
