#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
//const int INF = 1e8;
using namespace std;

int main(){
	int n;
	while(cin >> n, n){
		vector<complex<double>> p(n);
		rep(i,n){
			double x, y;
			char g;
			cin >> x >> g >> y;
			p[i] = complex<double>(x,y);
		}

		int maxi = 1;
		rep(i,n){
			range(j,i + 1,n){
				if(abs(p[i] - p[j]) > 2.0) continue;

				int cnt = 0;
				rep(k,n){
					if(abs(p[i] - p[k]) <= 2.0 and abs(p[j] - p[k]) <= 2.0) cnt++;
				}
				maxi = max(cnt, maxi);
			}
		}
		cout << maxi << endl;
	}
}

