#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;
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(this->x + a.x, this->y + a.y);
	}
	
	Point operator - (const Point& a) const {
		return Point(this->x - a.x, this->y - a.y);
	}
	
	Point operator * (Double a) const {
		return Point(this->x * a, this->y * a);
	}
	
	Point operator / (Double a) const {
		return Point(this->x / a, this->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));
}

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

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

Point rotate(const Vector& v, Double s) {
	return Point(v.x * cos(s) - v.y * sin(s),
				  v.x * sin(s) + v.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 = abs(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, abs(b.c - a.c), a.r);
			res.push_back(a.c + rotate(x, s));
			res.push_back(a.c + rotate(x, -s));
		}
	}
	
	return res;
}

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

int n;
vector< Circle > vc;

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 > vv = cross_point(vc[i], vc[j]);
		for_(k,0,size_of(vv)) vp.push_back(vv[k]);
	}
	
	int ans = 0;
	for_(i,0,size_of(vp)) {
		int cnt = 0;
		for_(j,0,n) if (inter(vc[j], vp[i])) ++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.0));
		}
		
		solve();
	}
	
	return 0;
}