#include <bits/stdc++.h>
using namespace std;
static const double EPS = 1e-8;
int n;
int main(void) {
  while (cin >> n) {
    if (n == 0) break;
    double x[100], y[100];
    for (int i = (0); i < (int)(n); ++i) {
      scanf("%lf,%lf", x + i, y + i);
    }
    int ans = 1;
    for (int i = 0; i < n; i++) {
      for (int j = i + 1; j < n; j++) {
        double dist =
            sqrt((x[j] - x[i]) * (x[j] - x[i]) + (y[j] - y[i]) * (y[j] - y[i]));
        if (dist > 2) continue;
        double thete = atan2(y[j] - y[i], x[j] - x[i]);
        double alpha = acos((dist * dist) / (2 * dist));
        double kx[2], ky[2];
        kx[0] = x[i] + cos(thete + alpha);
        ky[0] = y[i] + sin(thete + alpha);
        kx[1] = x[i] + cos(thete - alpha);
        ky[1] = y[i] + sin(thete - alpha);
        int tmp = 2;
        for (int k = (0); k < (int)(n); ++k) {
          if (i == k || j == k) continue;
          double d = sqrt((x[k] - kx[0]) * (x[k] - kx[0]) +
                          (y[k] - ky[0]) * (y[k] - ky[0]));
          if (d <= 2) tmp++;
        }
        ans = max(tmp, ans);
        tmp = 2;
        for (int k = (0); k < (int)(n); ++k) {
          if (i == k || j == k) continue;
          double d = sqrt((x[k] - kx[1]) * (x[k] - kx[1]) +
                          (y[k] - ky[1]) * (y[k] - ky[1]));
          if (d <= 2) tmp++;
        }
        ans = max(tmp, ans);
      }
    }
    cout << ans << endl;
  }
  return 0;
}
