#include<bits/stdc++.h>

using namespace std;

int mapData[10][10];

int main() {
	int n,tmp,sum;
	double x[100], y[100];
	char c;

	ios::sync_with_stdio(false);
	cin.tie(0);
	while (cin >> n, n) {
		for (int i = 0; i < n; i++) {
			cin >> x[i] >> c >> y[i];
		}

		sum = 0;
		for (double a = 0; (a-10) < 0.0001; a += 0.01) {
			for (double b = 0; (b-10) < 0.0001; b += 0.01) {
				tmp = 0;
				for (int i = 0; i < n; i++) {
					if( pow((a - x[i]), 2) + pow((b - y[i]), 2) - 1 < 0.0001) {
						tmp++;
					}
				}
				sum = max(sum, tmp);
			}
		}
		cout << sum << endl;
	}

	return 0;
}
