#include <bits/stdc++.h>
const double eps = 1e-10;
int main(void) {
  int n;
  while (scanf("%d", &n), n) {
    double x[128] = {0};
    double y[128] = {0};
    int is[128][128] = {0};
    for (int i = 0; i < n; i++) {
      scanf("%lf,%lf", &x[i], &y[i]);
    }
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        double xx = x[i] - x[j];
        double yy = y[i] - y[j];
        if (i == j) continue;
        if (xx * xx + yy * yy <= 4) {
          is[i][j] = 1;
        }
      }
    }
    int ans = 0;
    int a[128] = {0};
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        a[j] = is[i][j];
      }
      for (int j = 0; j < n; j++) {
        if (a[j]) {
          for (int k = 0; k < n; k++) {
            if (j == k) continue;
            if (a[k] && is[j][k]) {
              double xxx = x[i] + x[j] + x[k];
              double yyy = y[i] + y[j] + y[k];
              xxx /= 3;
              yyy /= 3;
              if (pow(xxx - x[i], 2) + pow(yyy - y[i], 2) > 1) a[k] = 0;
              if (pow(xxx - x[j], 2) + pow(yyy - y[j], 2) > 1) a[k] = 0;
              if (pow(xxx - x[k], 2) + pow(yyy - y[k], 2) > 1) a[k] = 0;
            }
            if (a[k] && !is[j][k]) {
              a[k] = 0;
            }
          }
        }
      }
      int t = 0;
      for (int j = 0; j < n; j++) t += a[j];
      ans = t > ans ? t : ans;
    }
    printf("%d\n", ans + 1);
  }
  return 0;
}
