#include <bits/stdc++.h>
using namespace std;
int main() {
  while (true) {
    int n;
    scanf("%d", &n);
    if (n == 0) break;
    vector<complex<double>> P;
    for (int i = 0; i < n; i++) {
      double r, im;
      scanf("%lf,%lf", &r, &im);
      P.push_back(complex<double>(r, im));
    }
    int ans = 0;
    for (auto p1 : P)
      for (auto p2 : P)
        if (p1 != p2) {
          double d = abs(p2 - p1);
          if (d < 2) {
            complex<double> t(d / 2, sqrt(1 - d * d / 4));
            t = t * polar(1., arg(p2 - p1)) + p1;
            int c = 0;
            for (auto p : P)
              if (abs(p - t) <= 1 + 1e-6) c++;
            ans = max(ans, c);
          }
        }
    printf("%d\n", ans);
  }
}
