#include <bits/stdc++.h>
using namespace std;

#define for_(i,a,b) for(int i=a;i<b;++i)
#define size_of(a) (int)a.size()

typedef double Double;
const Double EPS = 1e-9;

typedef struct Point {
	Double x, y;
	Point(Double _x, Double _y) : x(_x), y(_y) {}
	
	Point operator + (const Point& a) const {
		return Point(x + a.x, y + a.y);
	}
	
	Point operator - (const Point& a) const {
		return Point(x - a.x, y - a.y);
	}
	
	Point operator * (Double a) const {
		return Point(x * a, y * a);
	}
	
	Point operator / (Double a) const {
		return Point(x / a, y / a);
	}
} Vector;

Double norm(const Point& a) {
	return a.x * a.x + a.y * a.y;
}

Double abs(const Point& a) {
	return sqrt(norm(a));
}

Double dist(const Point& a, const Point& b) {
	return abs(a - b);
}

Vector unit_vector(const Vector& a) {
	return a / abs(a);
}

Double sqr(Double x) {
	return x * x;
}

Double angle(Double a, Double b, Double c) {
	return acos((sqr(b) + sqr(c) - sqr(a)) / (2.0 * b * c));
}

Point rotate(const Point& a, Double s) {
	return Point(a.x * cos(s) - a.y * sin(s),
				 a.x * sin(s) + a.y * cos(s));
}

struct Circle {
	Point c; Double r;
	Circle(Point _c, Double _r) : c(_c), r(_r) {}
};

int circle_intersect(const Circle& a, const Circle& b) {
	Double d = dist(a.c, b.c);
	if (a.r + b.r + EPS < d) return 0;
	if (b.r + d + EPS < a.r) return -3;
	if (a.r + d + EPS < b.r) return -4;
	if (fabs(a.r + b.r - d) < EPS) return 1;
	if (fabs(b.r + d - a.r) < EPS) return 3;
	if (fabs(a.r + d - b.r) < EPS) return 4;
	return 2;
}

vector< Point > cross_point(const Circle& a, const Circle& b) {
	vector< Point > res;
	Point x = unit_vector(b.c - a.c) * a.r;
	int ci = circle_intersect(a, b);
	
	if (ci > 0) {
		if (ci != 2) {
			res.push_back(a.c + x);
		} else {
			Double s = angle(b.r, dist(a.c, b.c), a.r);
			res.push_back(a.c + rotate(x, s));
			res.push_back(a.c + rotate(x, -s));
		}
	}
	
	return res;
}

int N;
vector< Circle > vc;

bool inter(const Point& a, const Circle& c) {
	Double d = dist(a, c.c);
	return d < c.r + EPS;
}

void solve() {
	vector< Point > vp;
	for_(i,0,N) vp.push_back(vc[i].c);
	
	for_(i,0,N) for_(j,i+1,N) {
		vector< Point > add = cross_point(vc[i], vc[j]);
		for_(k,0,size_of(add)) vp.push_back(add[k]);
	}
	
	int ans = 0;
	for_(i,0,size_of(vp)) {
		int cnt = 0;
		for_(j,0,N) if (inter(vp[i], vc[j])) ++cnt;
		ans = max(ans, cnt);
	}
	
	cout << ans << endl;
}

int main() {
	while (cin >> N, N) {
		vc.clear();
		
		for_(i,0,N) {
			Double x, y; scanf("%lf,%lf", &x, &y);
			vc.push_back(Circle(Point(x, y), 1.));
		}
		
		solve();
	}
	
	return 0;
}