#include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
#include<algorithm>

struct P{ double x, y; };
typedef std::pair<P, double> Cir;
typedef std::pair<P, P> Ret;

const double EPS = 1e-15;

Ret cross(Cir a, Cir b){
	Ret ret;
	ret.first.x = -100000;

	double x = a.first.x - b.first.x;
	double y = a.first.y - b.first.y;
	double l = std::sqrt(x*x + y*y);

	if (l > a.second + b.second)return ret;

	double c = std::atan2(b.first.y - a.first.y, b.first.x - a.first.x);
	double alpha = std::acos((l*l + a.second*a.second - b.second*b.second) / (2 * l*a.second));
	
	P r1, r2;
	r1.x = a.first.x + std::cos(c + alpha), r1.y = a.first.y + std::sin(c + alpha);
	r2.x = a.first.x + std::cos(c - alpha), r2.y = a.first.y + std::sin(c - alpha);

	ret.first = r1;
	ret.second = r2;

	return ret;
}

bool check(Cir cir, P p){
	double l = (cir.first.x - p.x)*(cir.first.x - p.x) + (cir.first.y - p.y)*(cir.first.y - p.y);
	l = std::sqrt(l);

	return (l <= cir.second + EPS);
}

int main(){
	int n;

	while (std::cin >> n, n){
		int res = 1;
		Cir data[1001];

		std::vector<P>search;
		for (int i = 0; i < n; i++){
			double x, y, r;
			scanf("%lf,%lf", &data[i].first.x, &data[i].first.y);
			data[i].second = 1.0;
		}

		for (int i = 0; i < n; i++){
			for (int j = i + 1; j < n; j++){
				Ret ret = cross(data[i], data[j]);
				if (ret.first.x != -100000)search.push_back(ret.first), search.push_back(ret.second);
			}
		}

		for (int i = 0; i < search.size(); i++){
			int cnt = 0;
			for (int j = 0; j < n; j++){
				cnt += check(data[j], search[i]);
			}
			res = std::max(res, cnt);
		}

		std::cout << res << std::endl;
	}

	return 0;
}