#include <bits/stdc++.h>
int judge(int xa, int ya, int xb, int yb) {
  double d = sqrt(pow((xa - xb), 2) + pow((ya - yb), 2));
  if (d < 0)
    return 0;
  else if (d < 0)
    return 0;
  else if (d > 2)
    return 0;
  else
    return 1;
}
int main() {
  int i, j, n;
  while (scanf("%d", &n)) {
    if (n == 0) break;
    int cnt, max = 0;
    double x[n], y[n];
    for (i = 0; i < n; i++) scanf("%lf,%lf", &x[i], &y[i]);
    for (i = 0; i < n; i++) {
      cnt = 0;
      for (j = 0; j < n; j++)
        if (judge(x[i], y[i], x[j], y[j]) == 1) cnt++;
      if (cnt > max) max = cnt;
    }
    printf("%d\n", max);
  }
  return 0;
}
