#include <bits/stdc++.h>
double dis(double x1, double x2, double y1, double y2) {
  return ((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
int main() {
  int n, count[101];
  double m[101][2];
  while (1) {
    scanf("%d", &n);
    if (n == 0) break;
    for (int i = 0; i < 101; i++) {
      count[i] = 0;
    }
    for (int i = 0; i < n; i++) {
      scanf("%lf,%lf", &m[i][0], &m[i][1]);
    }
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        double d = dis(m[i][0], m[j][0], m[i][1], m[j][1]);
        if (d <= 4.0) {
          count[i]++;
        }
      }
    }
    int max = 0;
    for (int i = 0; i < n; i++) {
      if (count[i] > max) {
        max = count[i];
      }
    }
    printf("%d\n", max);
  }
  return 0;
}
