#include <stdio.h>
#include <vector>
#include <algorithm>
#include <math.h>
#include <queue>

using namespace std;

struct Point{
	double x,y;
};

int main(){

	int n,max,count;
	Point point[100];

	while(true){
		scanf("%d",&n);
		if(n == 0)break;

		max = 0;

		for(int i = 0; i < n; i++){
			scanf("%lf,%lf",&point[i].x,&point[i].y);
		}

		for(double i = 0; i <= 10; i += 0.1){
			for(double k = 0; k <= 10; k+=0.1){
				count = 0;
				for(int p = 0; p < n; p++){
					if(sqrt((i-point[p].x)*(i-point[p].x)+(k-point[p].y)*(k-point[p].y)) < 1 ||
							fabs(sqrt((i-point[p].x)*(i-point[p].x)+(k-point[p].y)*(k-point[p].y))-1) < 0.00000001){
						count++;
					}
				}
				max = (max >= count)?max:count;
			}
		}

		printf("%d\n",max);

	}

	return 0;
}