#include <bits/stdc++.h>
using namespace std;
int CircleOverlapped(double ax, double ay, double ar, double bx, double by,
                     double br) {
  if ((ax - bx) * (ax - bx) + (ay - by) * (ay - by) < (ar + br) * (ar + br))
    return 1;
  return 0;
}
int main() {
  int n, max;
  float *x, *y;
  while (cin >> n, n) {
    x = new float[n];
    y = new float[n];
    max = 0;
    for (int i = 0; i < n; ++i) {
      scanf("%f,%f", &(x[i]), &(y[i]));
    }
    for (int i = 0; i < n; ++i) {
      int count = 0;
      for (int j = 0; j < n; ++j) {
        count += CircleOverlapped(x[i], y[i], 1, x[j], y[j], 1);
      }
      if (max < count) max = count;
    }
    cout << max;
  }
  return 0;
}
