#include <bits/stdc++.h>
using namespace std;
double x[100], y[100];
double px[10000], py[10000];
int main() {
  int a;
  while (scanf("%d", &a), a) {
    for (int i = 0; i < a; i++) scanf("%lf,%lf", x + i, y + i);
    int now = 0;
    for (int i = 0; i < a; i++) {
      for (int j = i + 1; j < a; j++) {
        if ((x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]) <
            4.0000001) {
          double d = sqrt((x[i] - x[j]) * (x[i] - x[j]) +
                          (y[i] - y[j]) * (y[i] - y[j]));
          double mx = (x[i] + x[j]) / 2;
          double my = (y[i] + y[j]) / 2;
          double s = sqrt(1 - d * d / 4);
          double theta = atan((y[i] - y[j]) / (x[i] - x[j]));
          px[now] = mx - sin(theta) * s;
          py[now++] = my + cos(theta) * s;
          px[now] = mx + sin(theta) * s;
          py[now++] = my - cos(theta) * s;
        }
      }
    }
    int ret = 0;
    for (int i = 0; i < now; i++) {
      int k = 0;
      for (int j = 0; j < a; j++)
        if ((px[i] - x[j]) * (px[i] - x[j]) + (py[i] - y[j]) * (py[i] - y[j]) <
            1.0000001)
          k++;
      ret = max(ret, k);
    }
    printf("%d\n", ret);
  }
}
