#include <iostream>
#include <cmath>
#include <algorithm>

using namespace std;

#define NMAX 100
#define EPS 1e-7

struct S{
	double x, y, r;
};

/*円と円の衝突*/
bool cr_cr(double cx1, double cy1, double cr1, double cx2, double cy2, double cr2){
	return pow(cx1 - cx2, 2.0) + pow(cy1 - cy2, 2.0) <= pow(cr1 + cr2, 2.0) + EPS;
}

int main(){

	int n;
	int cnt, ans;
	S seal[NMAX];
	char gav;

	while(1){

		cin >> n;
		if(n == 0) break;

		for(int i = 0; i < n; i++){
			cin >> seal[i].x >> gav >> seal[i].y;
			seal[i].r = 1.0;
		}

		ans = 0;
		for(int i = 0; i < n; i++){
			cnt = 1;
			for(int j = 0; j < n; j++){
				if(i != j && cr_cr(seal[i].x, seal[i].y, seal[i].r, seal[j].x, seal[j].y, seal[j].r)){
					cnt++;
				}
			}
			ans = max(ans, cnt);
		}

		cout << ans << endl;

	}
}