#include <cstdio>
#include <cmath>
#include <vector>
using namespace std;

#define sqr(x) ((x) * (x))

int main(void) {
	vector<pair<double,double> > in;
	vector<pair<double,double> > v;
	int n;
	int max = 0;

	while(1) {
		scanf("%d", &n);
		if(!n)
			break;
		for(int i = 0; i < n; i++) {
			pair<double,double> tmp;
			scanf("%lf,%lf", &tmp.first, &tmp.second);
			in.push_back(tmp);
		}

		for(int i = 0; i < n; i++) {
			for(int j = 0; j < n; j++) {
				double theta, phi;
				double sqr_d;
				if(i == j)
					continue;
				sqr_d = sqr(in[i].first - in[j].first) + sqr(in[i].second - in[j].second);
				if(sqr_d > 4)
					continue;

				theta = acos(sqr_d / (2 * sqrt(sqr_d)));
				phi = atan2(in[i].second - in[j].second, in[i].first - in[j].first);

				if(in[i].first > in[j].first)
					phi += 3.14159265;

				v.push_back(pair<double,double>(in[i].first + cos(phi + theta), in[i].second + sin(phi + theta)));
				v.push_back(pair<double,double>(in[i].first + cos(phi - theta), in[i].second + sin(phi - theta)));
			}
		}

		for(int i = 0; i < v.size(); i++) {
			int tmp = 0;
			for(int j = 0; j < n; j++) {
				double sqr_d;

				sqr_d = sqr(v[i].first - in[j].first) + sqr(v[i].second - in[j].second);
				if(sqr_d <= 1)
					tmp++;
			}
			
			if(tmp > max)
				max = tmp;
		}

		printf("%d\n", max);
	}

	return 0;
}