#include <bits/stdc++.h>
using namespace std;
int n;
complex<double> ps[100000];
int main() {
  while (1) {
    scanf("%d", &n);
    if (n == 0) return 0;
    for (int i = 0; i < n; i++) {
      double x, y;
      scanf("%lf,%lf", &x, &y);
      ps[i] = complex<double>(x, y);
    }
    int ans = 0;
    for (double x = 0.0; x <= 10.0; x += 0.1) {
      for (double y = 0.0; y <= 10.0; y += 0.1) {
        int cnt = 0;
        complex<double> p(x, y);
        for (int i = 0; i < n; i++) {
          if (norm(ps[i] - p) <= 1.0) cnt++;
        }
        ans = max(ans, cnt);
      }
    }
    printf("%d\n", ans);
  }
}
