#include <bits/stdc++.h>
using namespace std;
typedef struct {
  double x, y;
} POINT;
int main() {
  POINT p[100];
  int n;
  int ans = -1;
  while (1) {
    scanf("%d", &n);
    if (n == 0) break;
    for (int i = 0; i < n; i++) {
      scanf("%lf,%lf", &p[i].x, &p[i].y);
    }
    for (int i = 0; i < n; i++) {
      int count = 0;
      for (int j = 0; j < n; j++) {
        if (sqrt(pow(p[i].x - p[j].x, 2) + pow(p[i].y - p[j].y, 2)) <= 2) {
          count++;
        }
      }
      ans = max(ans, count);
    }
    printf("%d\n", ans);
  }
  return 0;
}
