#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  while (cin >> n, n) {
    double x[100], y[100];
    int m = 1;
    for (int i = 0; i < n; i++) scanf("%lf,%lf", &x[i], &y[i]);
    for (int i = 0; i < n; i++) {
      for (int j = i + 1; j < n; j++) {
        double dx, dy, dis, sq, s, t;
        int a;
        dx = x[i] - x[j];
        dy = y[i] - y[j];
        dis = dx * dx + dy * dy;
        if (dis <= 4) {
          sq = sqrt(dis - dis * dis / 4);
          s = ((dis / 2) * dx + dy * sq) / dis + x[j];
          t = ((dis / 2) * dy - dx * sq) / dis + y[j];
          a = 0;
          for (int k = 0; k < n; k++)
            if ((x[k] - s) * (x[k] - s) + (y[k] - t) * (y[k] - t) <= 1) a++;
          if (a > m) m = a;
          s = ((dis / 2) * dx - dy * sq) / dis + x[j];
          t = ((dis / 2) * dy + dx * sq) / dis + y[j];
          a = 0;
          for (int k = 0; k < n; k++)
            if ((x[k] - s) * (x[k] - s) + (y[k] - t) * (y[k] - t) <= 1) a++;
          if (a > m) m = a;
        }
      }
    }
    cout << m << endl;
  }
  return 0;
}
