#include <cstdio>
#include <cmath>
#define REP(i,a,b) for(int i=(a); i<(b); ++i)
#define rep(i, n) REP(i,0,n)
using namespace std;
#define N 110
double x[N], y[N];
int overlap[N][N], t[N];
double sqr(double x) { return x * x; }
double dist(double x, double y, double xx, double yy)
{
	//return sqrt(sqr(x-xx) + sqr(y-yy));
	return sqr(x-xx) + sqr(y-yy);
}
int main()
{
	int n;
	while (~scanf("%d", &n)) {
		if (n == 0) break;
		rep(i, n) scanf("%lf,%lf", x+i, y+i);
		rep(i, n) rep(j, n)
			overlap[i][j] = (dist(x[i], y[i], x[j], y[j]) <= 4.0) ? 1 : 0;

		int res = 0;
		rep(i, n) {
			rep(j, n) t[j] = overlap[i][j];
			rep(j, n) if (overlap[i][j]) rep(k, n) t[k] &= overlap[j][k];
			int c = 0;
			rep(j, n) c += t[j];
			if (res < c) res = c;
		}
		printf("%d\n", res);
	}
	return 0;
}