#include <bits/stdc++.h>
using P = std::complex<double>;
P 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++) {
        if (std::abs(p[j] - p[i]) > 2.0) continue;
        P xx = p[j] - p[i];
        P ce = p[i] + (xx / 2.0);
        P no1 = (ce * P(0, 1)) / std::abs(ce);
        P no2 = (ce * P(0, -1)) / std::abs(ce);
        double dis = sqrt(1 - pow(std::abs(xx) / 2.0, 2));
        P c = ce + no1 * dis;
        P q = ce + no2 * dis;
        int cnt1 = 2, cnt2 = 2;
        for (int k = 0; k < n; k++) {
          if (k == i || k == j) continue;
          if (std::abs(p[k] - c) <= 1.0) {
            cnt1++;
          }
          if (std::abs(p[k] - q) <= 1.0) {
            cnt2++;
          }
        }
        if (cnt1 > max) max = cnt1;
        if (cnt2 > max) max = cnt2;
      }
    }
    printf("%d\n", max);
  }
  return 0;
}
