#include <bits/stdc++.h>
using namespace std;
double cx[2], cy[2], x[100], y[100];
int cirxy(double x1, double y1, double x2, double y2) {
  double x3, y3, x4, y4, k, r;
  x3 = (x1 + x2) / 2;
  y3 = (y1 + y2) / 2;
  k = sqrt((x3 - x1) * (x3 - x1) + (y3 - y1) * (y3 - y1));
  if ((1 - k * k) < 0) return 1;
  r = sqrt(1 - k * k);
  if (x1 == x2) {
    cx[0] = x3 + r;
    cy[0] = cy[1] = y3;
    cx[1] = x3 - r;
    return 0;
  }
  if (y1 == y2) {
    cx[0] = cx[1] = x3;
    cy[0] = y3 + r;
    cy[1] = y3 - r;
    return 0;
  }
  x4 = fabs((y1 - y2)) * (r / (2 * k));
  y4 = fabs((x1 - x2)) * (r / (2 * k));
  if ((y1 - y2) / (x1 - x2) < 0) {
    cx[0] = x3 + x4;
    cy[0] = y3 + y4;
    cx[1] = x3 - x4;
    cy[1] = y3 - y4;
  } else {
    cx[0] = x3 + x4;
    cy[0] = y3 - y4;
    cx[1] = x3 - x4;
    cy[1] = y3 + y4;
  }
  return 0;
}
int main() {
  int n, i, j, k, h, c, mx;
  while (true) {
    cin >> n;
    mx = 1;
    if (n == 0) break;
    for (k = 0; k < n; k++) scanf("%lf,%lf", &x[k], &y[k]);
    for (i = 0; i < n - 1; i++) {
      for (j = i + 1; j < n; j++) {
        if (cirxy(x[i], y[i], x[j], y[j]) == 1) continue;
        for (h = 0; h < 2; h++) {
          c = 0;
          for (k = 0; k < n; k++)
            if (sqrt((cx[h] - x[k]) * (cx[h] - x[k]) +
                     (cy[h] - y[k]) * (cy[h] - y[k])) <= 1)
              c++;
          mx = max(c, mx);
        }
      }
    }
    cout << mx << endl;
  }
  return 0;
}
