#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)

typedef pair<double, double> pdd;
typedef vector<pdd> vp;

int main() {
	while (true) {
		int n;
		cin >> n;
		if (!n) break;
		
		vp v(n);
		REP(i, n) {
			double a, b;
			scanf("%lf,%lf", &a, &b);
			v[i] = pdd(a, b);
		}
		
		int ans = 0;
		double x1, x2, y1, y2;
		REP(i, n) {
			x1 = v[i].first;
			y1 = v[i].second;
			
			int maxer = 0;
			REP(j, n) {
				x2 = v[j].first;
				y2 = v[j].second;
				
				if ((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1) <= 4.0) maxer++;
			}
			ans = max(ans, maxer);
		}
		cout << ans << endl;
	}
	return 0;
}