#include <cstdio>
#include <cmath>
using namespace std;
double x[100], y[100];
int main()
{
	int n;
	while (true) {
		scanf("%d", &n);
		if (n == 0) break;
		for (int i = 0; i < n; ++i) scanf("%lf,%lf", &x[i], &y[i]);
		int res = 0;
		for (int i = 0; i < n; ++i) {
			int c = 1;
			for (int j = 0; j < n; ++j) {
				if (j == i) continue;
				double d = sqrt(pow(x[i] - x[j], 2) + pow(y[i] - y[j], 2)); 
				if (d <= 2) c++;
			}
			if (res < c) res = c;
		}
		printf("%d\n", res);
	}
	return 0;
}