#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  for (;;) {
    scanf("%d\n", &n);
    if (n == 0) break;
    vector<double> xs(n), ys(n);
    for (int i = 0; i < n; i++) {
      scanf("%lf,%lf\n", &xs[i], &ys[i]);
    }
    int ma = 0;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        double mx = (xs[i] + xs[j]) / 2, my = (ys[i] + ys[j]) / 2,
               len = sqrt(((xs[i] - xs[j]) * (xs[i] - xs[j])) +
                          ((ys[i] - ys[j]) * (ys[i] - ys[j])));
        double p1x = mx + (ys[i] - ys[j]) / len,
               p1y = my - (xs[i] - xs[j]) / len;
        double p2x = mx - (ys[i] - ys[j]) / len,
               p2y = my + (xs[i] - xs[j]) / len;
        int now = 0;
        for (int k = 0; k < n; k++) {
          if (sqrt(((xs[k] - p1x) * (xs[k] - p1x)) +
                   ((ys[k] - p1y) * (ys[k] - p1y))) <= 1)
            now++;
        }
        ma = max(now, ma);
        now = 0;
        for (int k = 0; k < n; k++) {
          if (sqrt(((xs[k] - p2x) * (xs[k] - p2x)) +
                   ((ys[k] - p2y) * (ys[k] - p2y))) <= 1)
            now++;
        }
        ma = max(now, ma);
      }
    }
    printf("%d\n", ma);
  }
}
