#include <bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define EPS (1e-8)

typedef complex<double> P;

vector<P> intersection(P a, P b) {
	vector<P> res;
	
	if (abs(abs(b - a) - 2.0) < EPS) {
		//????????\????????????
		P c = a + b;
		res.push_back(P(c.real() / 2.0, c.imag() / 2.0));
	}
	else if (abs(b - a) < 2.0) {
		//??????????????£?????????
		P ab = b - a;
		P nv1 = (ab * P(0, +1)) / abs(ab); //ab????¨??????????????????????????????????
		P nv2 = (ab * P(0, -1)) / abs(ab); //??????????????????????????????
		P c = a + P(ab.real() / 2.0, ab.imag() / 2.0); //ab???????????????????????????
		double d = sqrt(1 - pow(abs(ab) / 2.0, 2)); //????????¨ab???????????¨????????¢
		
		res.push_back(c + nv1 * d);
		res.push_back(c + nv2 * d);
	}
	
	return res;
}

int main() {
	while (true) {
		int n;
		cin >> n;
		if (!n) break;
		
		P p[100];
		REP(i, n) {
			double a, b;
			scanf("%lf,%lf", &a, &b);
			p[i] = P(a, b);
		}
		
		int ans = 1;
		REP(i, n) {
			FOR(j, i + 1, n) {
				vector<P> v = intersection(p[i], p[j]);
				if (v.empty()) continue;
				
				int cnt1 = 2, cnt2 = 2;
				REP(k, n) if (i != k && j != k) {
					if (abs(v[0] - p[k]) - 1.0 < EPS) cnt1++;
					if (v.size() == 2 && abs(v[1] - p[k]) - 1.0 < EPS) cnt2++;
				}
				
				ans = max(ans, max(cnt1, cnt2));
			}
		}
		cout << ans << endl;
	}
	return 0;
}