#include <iostream>
#include <cmath>
#include <complex>
#include <algorithm>
using namespace std;
typedef complex<double> C;

#define EPS (1e-8)

int n;
C p[101];

void solve() {
	char c;
	for (int i = 0; i < n; i++) {
		cin>>p[i].real()>>c>>p[i].imag();
	}

	int max_count = 0;
	for (int i = 0; i < n; i++) {
		int count = 1;
		for (int j = 0; j < n; j++) {
			if (i == j) continue;

			C ij = p[i] - p[j];
			if (abs(ij) < 2.0 + EPS ){
				count++;
			}
		}
		//cout<<i<<"|"<<count<<endl;
		max_count = max(count, max_count);
	}

	cout<<max_count<<endl;
}

int main(int argc, const char *argv[]) {
	while (cin>>n, n) {
		solve();
	}
	return 0;
}