#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;

	while(1) {
		int max = 1;
		in.clear();
		v.clear();
		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 = i + 1; j < n; j++) {
				double theta, phi;
				double sqr_d;

				sqr_d = sqr(in[i].first - in[j].first) + sqr(in[i].second - in[j].second);
				if(sqr_d > 4)
					continue;
				else if(sqr_d < 0.000000000001) {
					v.push_back(pair<double,double>(in[i].first, in[i].second));
					continue;
				}

				theta = acos(sqr_d / (2 * sqrt(sqr_d)));
				phi = atan2(in[j].second - in[i].second, in[j].first - in[i].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;
			/*
			if(v[i].first < 0 || v[i].first > 10 || v[i].second < 0 || v[i].second > 10)
				continue;
			// */
			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.00000001)
					tmp++;
			}
			
			if(tmp > max)
				max = tmp;
		}

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

	return 0;
}