#include <stdio.h>

#define SQ(x) ((x) * (x))

bool isCollision(double x1, double y1, double x2, double y2)
{
	return (SQ(x1 - x2) + SQ(y1 - y2) <= SQ(1 * 2));
}

int main(void)
{
	int n;
	double x[100], y[100];
	int count;
	int set[100];
	int answer;
	
	while (1){
		
		scanf("%d", &n);
		if (n == 0){
			break;
		}
		for (int i = 0; i < n; i++){
			scanf("%lf,%lf", &x[i], &y[i]);
		}
		
		answer = 0;
		for (int i = 0; i < n; i++){
			set[0] = i;
			count = 1;
			for (int j = 0; j < n; j++){
				if (i != j){
					bool flag = false;
					for (int k = 0; k < count; k++){
						if (isCollision(x[set[k]], y[set[k]], x[j], y[j]) == true){
							flag = true;
							break;
						}
					}
					if (flag == true){
						set[count++] = j;
					}
				}
			}
			if (count > answer){
				answer = count;
			}
		}
		
		printf("%d\n", answer);
	}
	
	return (0);
}