#include <bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define repb(i,a,b) for(int i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define int long long
#define fi first
#define se second
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

double dist(pair<double, double> a1, pair<double, double> a2) {
	return pow((a1.fi - a2.fi), 2) + pow((a1.se - a2.se), 2);
}

pair<double,double> p[110];

signed main(){
	int n;
	while (1) {
		//vector<pair<double, double> > p(n);
		scanf("%d", &n);
		if (n == 0) break;
		rep(i, 0, n) {
			//cout << 0 << endl;
			double x, y;
			scanf("%lf,%lf", &x, &y);
			p[i].fi = x;
			p[i].se = y;
		}
		int MAX = 0;
		for (double y = 0.00; y <= 10.01; y += 0.01) {
			for (double x = 0.00; x <= 10.01; x += 0.01) {
				int cnt = 0;
				rep(k, 0, n) {
					if (dist(p[k], (make_pair(x, y))) < 1.0001) cnt++;
				}
				MAX = max(MAX, cnt);
			}
		}
		printf("%d\n", MAX);
	}
}