#include <iostream>
#include <cstdio>
using namespace std;

int main(){
	double sx[100];
	double sy[100];
	double x, y;
	int i, j, n, cnt, max_cnt;
	while(true){
		max_cnt = 0;
		cin>>n;
		if(n == 0) break;
		for(i = 0; i < n; i++){
			scanf("%lf,%lf", &sx[i], &sy[i]);
		}
		for(i = 0; i < n; i++){
			cnt = 0;
			for(j = 0; j < n; j++){
				x = sx[i] - sx[j];
				y = sy[i] - sy[j];
				if( (x*x + y*y) < 4){
					cnt++;
				}
			}
			if(max_cnt < cnt){
				max_cnt = cnt;
			}
		}//i==j overlaps+1;
		cout << max_cnt << endl;
	}
	return 0;
}

//r+r=2 = root4
//x^2+y^2 < root4   >>>>>Overlap
//(-x)^2 == x^2