#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 d[110][110];

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

signed main() {
	int n;
	while (cin >> n && n) {
		vector<pair<double, double> > p(n);
		rep(i, 0, n) {
			cin >> p[i].fi;
			cin.ignore();
			cin >> p[i].se;
		}
		int MAX = 0;
		rep(i, 0, n) {
			int cnt = 0;
			rep(j, 0, n) {
				//o(i << " " << j << " " << dist(p[i], p[j]));
				if ((dist(p[i], p[j]) - 2.0) < 1e-8) cnt++;
			}
			MAX = max(MAX, cnt);
		}
		cout << MAX << endl;
	}
}