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

using Float = double;
using Point = complex<Float>;
struct Line{
	Point a,b;
	Line(Point a,Point b) : a(a),b(b){}
};
struct Segment : Line{ Segment(Point a,Point b) : Line(a,b){} };
struct Circle{ Point p; Float r; };

const Float EPS = 1e-8;

inline bool eq(Float a,Float b) { return abs(a - b) < EPS; }
inline Float dot(const Point &a,const Point &b){ return real(conj(a) * b); }
inline Float cross(const Point &a,const Point &b){ return imag(conj(a) * b); }

vector<Point> crosspoint(const Circle &c1,const Circle &c2){
	vector<Point> ret;
	Point d = c2.p - c1.p;
	Float rcosa = (c1.r * c1.r + norm(d) - c2.r * c2.r) / (abs(d) * 2);
	if(eq(0,abs(d)) || abs(rcosa) > c1.r) return ret;
	Float rsina = sqrt(c1.r * c1.r - rcosa * rcosa);
	ret.push_back(c1.p + d / abs(d) * Point(rcosa,rsina));
	if(!eq(rcosa,c1.r)) ret.push_back(c1.p + d / abs(d) * Point(rcosa,-rsina));
	return ret;
}

Float distance(Point &p1,Point &p2){
    return abs(p1 - p2);
}

bool contain(Circle &c,Point &p){
    return (distance(c.p,p) <= c.r + EPS);
}

int n;

void solve(){
	Circle cs[110];
	for(int i = 0;i < n;i++){
		double x,y;
		scanf("%lf,%lf",&x,&y);
		cs[i] = {Point(x,y),1};
	}
	if(n <= 1){
		printf("%d\n",n);
		return;
	}
	vector<Point> ps;
	for(int i = 0;i < n;i++){
		for(int j = i + 1;j < n;j++){
			vector<Point> cp = crosspoint(cs[i],cs[j]);
			ps.insert(ps.end(),cp.begin(),cp.end());
		}
	}
	int ans = 0;
	for(Point &p : ps){
		int sum = 0;
		for(int i = 0;i < n;i++){
			if(contain(cs[i],p)) sum++;
		}
		ans = max(ans,sum);
	}
	printf("%d\n",ans);
}

signed main(){
	while(scanf("%d",&n),n) solve();
}
