/* ????§£????????? */
#include <cstdio>
#include <complex>
using namespace std;

#define EPS 0.1

typedef complex<double> Point;

int n;
Point 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] = Point(x, y);
    }

    int ans = 0;
    for (double x=0.0; x<=10.0; x+=EPS) {
      for (double y=0.0; y<=10.0; y+=EPS) {
        int cnt = 0;
        Point 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);
  }
}