#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) {
        double d = abs(p2 - p1);
        if (d < 1) {
          complex<double> t(d / 2, sqrt(1 - d * d / 4));
          t = t * polar(arg(p2 - p1)) + p1;
          int c = 0;
          for (auto p : P)
            if (abs(p - t) <= 2 + 1e-9) c++;
          ans = max(ans, c);
        }
      }
    printf("%d\n", ans);
  }
}
